Closed steveblue closed 7 years ago
I can see the same problem in an angular project with ngx-bootstrap library after upgrade of angular from 4.1 to 4.2.
The issue preventing Package Format 4.0 from building correctly has been fixed in 4.3.0-beta.0
. I will update a branch ASAP to track this change.
Updated on feature/4.3.0-beta.0 branch. Verified the library bundle is not producing circular imports in ngfactory files any longer.
Whenever a package that conforms to Angular Package Format 4.0 is imported, the ngfactory.ts file is not directly compatible with Rollup. The
bugfix/package-4-import
reproduces the issue with Angular Material, but I have been able to reproduce with libraries generated with this repo as well that also comfort to Angular Package Format 4.0.To reproduce the issue:
Example of the error:
This is due to malformed
index.ngfactory.js
from Angular Material.angular2-rollup/ngfactory/node_modules/@angular/material/typings/index.ngfactory.js
^ index.ngfactory.js is importing itself
NOT IDEAL WORKAROUND:
Stop the above process.
Duplicate
index.ngfactory.js
and rename it toindex.ngfactory.imports.js
Changeimport * as i4 from './index.ngfactory';
inindex.ngfactory.js
toimport * as i4 from './index.ngfactory.imports';
Run the following commands which would be the next steps in the build after ngc:
npm run bundle:prod
npm run transpile:prod
npm run serve
The Material Checkbox is there now, it is hiding on the bottom left of the Angular logo. Click to reveal.
This process could be scripted with a custom build in this repo. It could get tricky with multiple libraries though, each would probably have to be whitelisted for a script. This of course is not ideal, ngc should be able to handle ngfactory files in a way Rollup can interpret.