Repository navigation
Closed
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/common
Description
fesm5/common.js has no ngInjectableDef for Location after running ngcc, whereas it exists for fesm2015/common.js, leading to an error at runtime when using Ivy.
🔬 Minimal Reproduction
ng new ivy-location --defaults
$(npm bin)/ivy-ngcc
# enable ivy in `tsconfig.app.json`
# add `RouterModule.forRoot([])` in app.module.ts
ng serve --aot
# check the runtime error in the browser
🔥 Exception or Error
In Firefox
ERROR TypeError: "token is undefined"
get http://localhost:4200/vendor.js:42903:13
get http://localhost:4200/vendor.js:43265:20
injectInjectorOnly http://localhost:4200/vendor.js:35691:16
inject http://localhost:4200/vendor.js:35696:13
Location_Factory ng://Location/ngInjectableDef.js:8:28
In Chrome:
ERROR TypeError: Cannot read property '__source' of undefined
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8984)
at R3Injector.push../node_modules/@angular/core/fesm5/core.js.R3Injector.get (core.js:9346)
at injectInjectorOnly (core.js:1772)
at inject (core.js:1777)
at Object.Location_Factory [as factory] (ngInjectableDef.js:8)
After digging a little bit, it looks like in fesm5/common.js, there is no ngInjectableDef metadata on Location (look for Location_Factory in ./node_modules/@angular/common/fesm5/common.js).
But it is present in fesm2015/common.js...
🌍 Your Environment
Angular Version:
Angular CLI: 7.2.0
Node: 10.14.1
OS: darwin x64
Angular: 7.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.12.0
@angular-devkit/build-angular 0.12.0
@angular-devkit/build-optimizer 0.12.0
@angular-devkit/build-webpack 0.12.0
@angular-devkit/core 7.2.0
@angular-devkit/schematics 7.2.0
@ngtools/webpack 7.2.0
@schematics/angular 7.2.0
@schematics/update 0.12.0
rxjs 6.3.3
typescript 3.2.2
webpack 4.23.1
Metadata
Metadata
Assignees
Labels
No labels
Activity
alexzuza commentedon Jan 11, 2019
Duplicate of #27794
Waiting for #27848 to be landed
angular-automatic-lock-bot commentedon Sep 14, 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.