"Class constructor NgModuleInjector cannot be invoked without 'new'" when AOT with fesm15 files
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior When building an app with fesm15 and AOT I get the following exception in the browser during bootstrap:
app.module.ngfactory.ts:55 Uncaught TypeError: Class constructor NgModuleInjector cannot be invoked without 'new'
at new AppModuleInjector (app.module.ngfactory.ts:55)
at NgModuleFactory.create (ng_module_factory.ts:70)
at ngZone.run (application_ref.ts:301)
at ZoneDelegate.webpackJsonp.ZSR1.ZoneDelegate.invoke (zone.js:334)
at Object.onInvoke (ng_zone.ts:256)
at ZoneDelegate.webpackJsonp.ZSR1.ZoneDelegate.invoke (zone.js:333)
at Zone.webpackJsonp.ZSR1.Zone.run (zone.js:126)
at NgZone.run (ng_zone.ts:142)
at PlatformRef_._bootstrapModuleFactoryWithZone (application_ref.ts:299)
at PlatformRef_.bootstrapModuleFactory (application_ref.ts:332)
at Object.x35b (main.ts:11)
at __webpack_require__ (bootstrap 21cb324…:52)
at Object.2 (app.component.ngfactory.ts:48)
at __webpack_require__ (bootstrap 21cb324…:52)
at webpackJsonpCallback (bootstrap 21cb324…:23)
Expected behavior no error 😃
Minimal reproduction of the problem with instructions
ng new --ng4 test-app
- edit
vi node_modules/\@angular/cli//models/webpack-configs/common.js
andmainFields: ["es2015", "module", "main"]
toresolve: { ... }
block - disable Uglify in
node_modules/\@angular/cli//models/webpack-configs/common.js
- ng serve --prod --sm
- open http://localhost:4200 and check error in console
- Angular version: 4.0.0-rc.5
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirmed. I modified the tsconfig in my app to
"target": "es2015"
and now it worksThis 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.