ERROR in Symbol when compiling with Ivy
See original GitHub issueπ bug report
Affected Package
ngcc?Is this a regression?
Version 8.0.3 which is current latest produces a different error as discussed with @petebacondarwin in angular/angular/pull/27326#issuecomment-506625841. Upgrading to 8.1.0-rc.0 fixes the ModuleWithProviders issue but now is returning error below.Description
When running normal production build with aot=true and Ivy disabled the build process completes successfully. Running with Ivy enabled results in the below error.π¬ Minimal Reproduction
https://github.com/davidjeliba/angular-uirouterhybrid-ivy-issue
master branch uses 8.1.0-rc.0 βlatestβ branch uses angular@latest which is currently 8.0.3 - I provided this just in case there is any value in seeing the previous ModuleWithProviders error.
To setup/run:
Clone project run βyarnβ run βyarn build:productionβ - aot=true, ivy=false - to show successful compilation run βyarn build:production:ivyβ - aot=true, ivy=true - produces the error
π₯ Exception or Error
ERROR in Symbol UIRouterModule declared in angular-uirouterhybrid-ivy-issue/node_modules/@uirouter/angular/lib/uiRouterNgModule.d.ts is not exported from @uirouter/angular-hybrid (import into angular-uirouterhybrid-ivy-issue/src/app/child.module.ts)
π Your Environment
Angular Version:
Angular CLI: 8.1.0-rc.0
Node: 10.15.3
OS: darwin x64
Angular: 8.1.0-rc.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, upgrade
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.0-rc.0
@angular-devkit/build-angular 0.801.0-rc.0
@angular-devkit/build-optimizer 0.801.0-rc.0
@angular-devkit/build-webpack 0.801.0-rc.0
@angular-devkit/core 8.1.0-rc.0
@angular-devkit/schematics 8.1.0-rc.0
@ngtools/webpack 8.1.0-rc.0
@schematics/angular 8.1.0-rc.0
@schematics/update 0.801.0-rc.0
rxjs 6.5.2
typescript 3.4.5
webpack 4.35.0
Anything else relevant? After running yarn build:production:ivy and inspecting angular-uirouterhybrid-ivy-issue/node_modules/@uirouter/angular-hybrid/lib/angular-hybrid.d.ts the code is as follows from line 96:
export declare class UIRouterUpgradeModule {
static forRoot(module?: NgHybridStatesModule): ModuleWithProviders<UIRouterUpgradeModule>;
static forChild(module?: NgHybridStatesModule): ModuleWithProviders<Ι΅ngcc1.UIRouterModule>;
static ngModuleDef: Ι΅ngcc0.Ι΅Ι΅NgModuleDefWithMeta<UIRouterUpgradeModule, [typeof UIViewNgUpgrade], [typeof Ι΅ngcc1.UIRouterModule, typeof Ι΅ngcc2.UpgradeModule], [typeof UIViewNgUpgrade, typeof Ι΅ngcc1.UIRouterModule]>;
static ngInjectorDef: Ι΅ngcc0.Ι΅Ι΅InjectorDef<UIRouterUpgradeModule>;
}
Iβm not sure if it is relevant that forRoot has ModuleWithProviders<UIRouterUpgradeModule> while forChild has ModuleWithProviders<engcc1.UIRouterModule>
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
This is a bug in ngtsc.
When we statically interpret the
Ι΅ngcc1.UIRouterModule
type expression we lose the fact that it is jumping to another file (probably because of the namespaced import). So then ngtsc thinks thatUIRouterModule
was declared inside@uirouter/angular-hybrid
rather than@uirouter/angular
. Therefore it thinks thatUIRouterModule
is an internal non-exported class inside@uirouter/angular-hybrid
, which is basically what the error message is telling us.Working on a fix π
Here we go: https://github.com/angular/angular/pull/31367