Open jkyoutsey opened 8 years ago
Me too facing same issue when used with 1.6.0
I am using Angular2-webpack-starter with beta 6
@sasidhar I tried going back through several versions with no change to behavior. I'm on ng2 beta 7.
@jkyoutsey Did you try with es7-reflect-metadata - version 1.5.5?
If you use ^1.5.5
, as new version 1.6.0
is available, it will install that.
Can you try removing the caret (^) and try? For me it fixed.
@sasidhar THANK YOU! I had done that, but probably missed an npm run clean:build and it didn't revert the version that was there! That indeed did fix it for me.
Confirms that there is an issue with 1.6.0.
I've finally got angular2 beta 15 running with both Webpack and System.js (... this has taken a while!)
There are issues with es7-reflect-metadata
version 1.5.5 as well... Chrome Canary 49.0.2623.110 throws up errors to do with the strict Map.length and Set.length being read-only (see https://github.com/gdi2290/es7-reflect-metadata/commit/729120155a798c49a7f07efcbc064b003aec5572).
In src/helper/create-uuid.ts
you can fix the crypto
issue by replacing:
import {genRandomBytes} from "./gen-randombytes";
with this:
import {genRandomBytes} from "./gen-randombytes.browser";
I think crypto
is part of the Node.js API is thus won't work with Typescript / ts-loader, especially on webpack.
Now my head hurts...
+1 I was getting crypto not found error for version 1.6.0... switching to 1.5.5 got rid of the error. Cheers.
@gdi2290 can we expect an update on this? Or is this expected behaviour? Downgrading always seems like an awkward solution.
I'm getting two errors in my browser console (Chrome latest). See end of message for call stacks. My webpack build succedes, but the browser won't finish loading the page due to the errors. My package.json specifies:
"es7-reflect-metadata": "^1.5.5",
Uncaught TypeError: crypto.randomBytes is not a functiongenRandomBytes @ gen-randombytes.ts:5createUUID @ create-uuid.ts:5createUniqueKey @ create-unique-key.ts:11(anonymous function) @ weakmap.ts:5__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ metadata.ts:1__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ reflect-metadata.ts:22__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ browser.ts:1__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ polyfills.ts:18__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ bootstrap ce8ea336ef6e370d804f:93(anonymous function) @ bootstrap ce8ea336ef6e370d804f:93 decorators.ts:242Uncaught reflect-metadata shim is required when using class decorators(anonymous function) @ decorators.ts:242__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ decorators.ts:9__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:18__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:2__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ metadata.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ core.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ main.ts:4__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50webpackJsonpCallback @ bootstrap ce8ea336ef6e370d804f:21(anonymous function) @ main.bundle.js:1
And
Uncaught reflect-metadata shim is required when using class decorators(anonymous function) @ decorators.ts:242__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ decorators.ts:9__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:18__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:2__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ metadata.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ core.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ main.ts:4__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50webpackJsonpCallback @ bootstrap ce8ea336ef6e370d804f:21(anonymous function) @ main.bundle.js:1