You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ES2015 + emitDecoratorMetadata causes Cannot access before intialization #15077
main.js:98 Uncaught ReferenceError: Cannot access 'AppService' before initialization
at Module../src/app.component.ts (main.js:98)
at __webpack_require__ (runtime.js:80)
at Module../src/app.module.ts (main.js:123)
at __webpack_require__ (runtime.js:80)
at Module../src/main.ts (main.js:157)
at __webpack_require__ (runtime.js:80)
at Object.0 (main.js:174)
at __webpack_require__ (runtime.js:80)
at checkDeferredModules (runtime.js:46)
at Array.webpackJsonpCallback [as push] (runtime.js:33)
🌍 Your Environment
Angular Version:
Angular 8.1.1
Anything else relevant?
Removing emitDecoratorMetadata, or targeting es5 fixes the problem.
This TypeScript option has a fundamental design limitation with ES2015+ code and is best avoided when targeting such output. As such this is an issue with TypeScript itself and not Angular.
Angular 8+ no longer requires the option. It was also previously only required for JIT mode which is typically only used in development.
Maybe it would be good to check for that when upgrading angular, or mention it in the docs? This just took me quiet a bit to figure out after upgrading from angular 7 -> 8
Reacted by Claudiu Hojda and jaa1982
angular-automatic-lock-bot commented on Sep 9, 2019
Activity
alan-agius4 commentedon Jul 15, 2019
Hi, is there a reason why you need
emitDecoratorMetadatato be true?By the way @pauldraper, love your repo.
clydin commentedon Jul 15, 2019
This TypeScript option has a fundamental design limitation with ES2015+ code and is best avoided when targeting such output. As such this is an issue with TypeScript itself and not Angular.
Angular 8+ no longer requires the option. It was also previously only required for JIT mode which is typically only used in development.
piotrpalek commentedon Aug 7, 2019
Maybe it would be good to check for that when upgrading angular, or mention it in the docs? This just took me quiet a bit to figure out after upgrading from angular 7 -> 8
angular-automatic-lock-bot commentedon Sep 9, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.