Uncaught reflect-metadata shim is required when using class decorators
See original GitHub issueOS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) El Capitan
Versions. Please run ng --version
. If there’s nothing outputted, please run in a Terminal: node --version
and paste the result here:
angular-cli: 1.0.0-beta.11-webpack.2 node: 4.4.2 os: darwin x64
Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.
-
Start a project with Angular CLI (Webpack)
-
Create a standalone class (e.g. a model) with an
EventEmitter
property. -
When
new EventEmitter<...>()
is called in that class, this error shows on the browser console.Uncaught reflect-metadata shim is required when using class decorators
The log given by the failure. Normally this include a stack trace and some more information.
All I see is:
Uncaught reflect-metadata shim is required when using class decorators / output_ast.js:334
Mention any other details that might be useful.
This works fine in a non-webpack setting, like here:
http://plnkr.co/edit/255WLWdkSnZdMfNvCk3I?p=preview
That Plunkr works and shows what I am trying to do. The problem is when I do this exact same thing when using Webpack.
Also, EventEmitter
works just fine if used in a component.
I am not sure whether this is a bug or user error. Please apologize me if it’s the latter.
Thanks in advance!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
I had the same issue when i’ve migrated to angular-cli’s github master branch from npm version
while doing
ng init
to update angular-cli generated files, i’ve missedimport "./polyfills.ts";
on top ofmain.ts
fileadding this line fixed my problem
Absolutely. I’ll put something together and upload the repo here this week.