angular: UIrouter compile error with Angular Ivy
Hi!
When using Angular Ivy compiler ng build --prod fails with
ERROR in src/app/app.module.ts(12,12): error TS-991010: Value at position 1 in the NgModule.importss of AppModule is not a reference: [object Object]
The ivy-ngcc compiler gives some warnings that could be related:
Compiling @uirouter/core : module as esm5 Warning: Unknown member type: "[key: string]: any; Compiling @uirouter/angular : module as esm5 Warning: Unknown member type: "[key: string]: any;
Here is a github repo to reproduce the issue uirouterivy and this commit is all that was done on top of a ng new uirouterivy .
Steps to reproduce the issue:
git clone https://github.com/jr01/uirouterivy
cd uirouterivy
npm install
ng build --prod
It works fine w/o Angular Ivy:
git checkout 456833
ng build --prod
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 15
- Comments: 27 (15 by maintainers)
Released v6.0.0 https://github.com/ui-router/angular/releases/tag/6.0.0
I’ve made more some progress
I’m not going to make any promises on timing of an ivy compatible release, but things are looking pretty good
So I tried the ng-packagr branch with the app from my initial post and I got it to work.
Here is what I did:
For @uirouter/angular
git clone https://github.com/ui-router/angular .in folderC:\custom_npm\@uirouter\angulargit checkout ng-packagrnpm installng-packagr -p package.jsonFor the app
git clone https://github.com/jr01/uirouterivy .ng update @angular/cli @angular/core rxjsrd /s/q node_modulesnpm installModified angular.json set
"preserveSymlinks": true,as suggested hereng serveworks 😃Applied some of the @uirouter/angular Hello World example and confirmed some simple routing works 😃
Here is my ng-packagr testing branch for the app: https://github.com/jr01/uirouterivy/compare/ng-packagr?expand=1
I’ll do some more testing, final goal is to get an ngupgrade + @uirouter/angular-hybrid application to work with Angular 9.
Many thanks so far @christopherthielen 🥇
I played around with this a bit over the weekend. I think the solution to this may be to use
ng-packagrto create a npm package that conforms to the angular package format.This may require a break in compatibility with Angular v5 but that’s OK. We would need another major release of ui-router for Angular (version 5.0.0)
Thank you for this issue with clear reproduction steps. I will take a look this weekend!
published https://github.com/ui-router/angular-hybrid/releases/tag/10.0.0
Great @christopherthielen - can you release
@uirouter/angular-hybridtoo? Currently that is pinned to use@uirouter/angular@5so it is still broken with ivy.@christopherthielen
What issues did you have? Got the WIP somewhere?
update: I was able to build the package using ng-packagr and added ui-router to a brand new “
ShinyIvyApp”. However, I ran into troubles trying to update thesample-app-angularto use ivy.here’s the branch with ng-packagr support
https://github.com/ui-router/angular/compare/ng-packagr?expand=1
To test this locally, I’m using https://github.com/whitecolor/yalc as a local package publisher.
Build
@uirouter/angularlocally usingng-packagr:Publish the
distfolder locally usingyalc:Now add it to your downstream app using yalc.
Yarn will complain about missing peer dependencies, so also add the two upstream uirouter dependencies.