angular: Ivy fails with NGXS
π bug report
Is this a regression?
Yes, it is
Description
NGXS works with Angular 8, but build fails when enableIvy
is true
π¬ Minimal Reproduction
https://github.com/arturovt/ivy-ngxs-repro
- create new app with
--enable-ivy
- install
@ngxs/store
- import the
NgxsModule
- build with
--prod
flag
π₯ Exception or Error
chunk {0} runtime-es5.465c2333d355155ec5f3.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main-es5.f306d8f70fdeea68d975.js (main) 178 kB [initial] [rendered]
chunk {2} polyfills-es5.e0a0858fa7791e140ae9.js (polyfills) 113 kB [initial] [rendered]
Date: 2019-07-23T07:08:02.084Z - Hash: 93ed973fa7b88e080f3b - Time: 17265ms
ERROR in ./src/app/app.module.ts 19:104-121
"export 'NgxsRootModule' (imported as 'i1') was not found in '@ngxs/store'
π Your Environment
Angular Version:
Angular CLI: 9.0.0-next.2
Node: 12.6.0
OS: linux x64
Angular: 9.0.0-next.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Anything else relevant? May be related to the #29939
UPD
Itβs built without errors using CLI 9.0.0-next.2
version. But there is a runtime error after importing NgxsRouterPluginModule
:
Canβt resolve all parameters for RouterState: (?, ?, ?, ?, ?, ?, ?).
Because there is no ngInjectableDef
property on the RouterState
.
Also when running ivy-ngcc
it fails compiling @ngxs/router-plugin as umd
:
Value at position 0 in the NgModule.imports of NgxsRouterPluginModule is not a reference: [object Object]
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 12
- Comments: 16 (11 by maintainers)
Commits related to this issue
- fix(ngcc): correctly read static properties for aliased classes In ESM2015 bundles, a class with decorators may be emitted as follows: ```javascript var MyClass_1; let MyClass = MyClass_1 = class My... — committed to JoostK/angular by JoostK 5 years ago
- fix(ngcc): correctly read static properties for aliased classes In ESM2015 bundles, a class with decorators may be emitted as follows: ```javascript var MyClass_1; let MyClass = MyClass_1 = class My... — committed to JoostK/angular by JoostK 5 years ago
- fix(ngcc): correctly read static properties for aliased classes In ESM2015 bundles, a class with decorators may be emitted as follows: ```javascript var MyClass_1; let MyClass = MyClass_1 = class My... — committed to JoostK/angular by JoostK 5 years ago
- fix(ngcc): resolve imports in `.d.ts` files for UMD/CommonJS bundles In ngcc's reflection host for UMD and CommonJS bundles, custom logic is present to resolve import details of an identifier. Howeve... — committed to JoostK/angular by JoostK 5 years ago
- fix(ngcc): resolve imports in `.d.ts` files for UMD/CommonJS bundles (#32619) In ngcc's reflection host for UMD and CommonJS bundles, custom logic is present to resolve import details of an identifie... — committed to angular/angular by JoostK 5 years ago
- fix(ngcc): correctly read static properties for aliased classes (#32619) In ESM2015 bundles, a class with decorators may be emitted as follows: ```javascript var MyClass_1; let MyClass = MyClass_1 =... — committed to arnehoek/angular by JoostK 5 years ago
- fix(ngcc): resolve imports in `.d.ts` files for UMD/CommonJS bundles (#32619) In ngcc's reflection host for UMD and CommonJS bundles, custom logic is present to resolve import details of an identifie... — committed to arnehoek/angular by JoostK 5 years ago
@arturovt there was indeed an issue with resolving
store.NgxsModule.forFeature([RouterState])
in both CommonJS and UMD bundles, for which I included a fix in #32619. With those fixes, the compilation no longer fails πJust to add in here, I have just tested this repo with Angular 8.2.0-next.2 and it has the same build failures. In the referenced firebase issue it was suggested that this would be fixed by PR #30591 but this PR seems to have been merged, closed (although there seem to be more subsequent commits on it?) and is part of the Angular 8.2.0-next.2 package. The issue is unfortunately still present in this version.
@JoostK great, dank je wel π
@alxhub @AndrewKushnir Angular 9.beta + NGXS works now, but
@ngxs/router-plugin
not working with Ivyfor reproduction
app.module.ts
app.state.ts
store-ivy.module.ts
Build successful, but runtime error after
ng serve
But works with Angular 7, 8 with ViewEngine