Angular 8 + ivy + ng build library usage error
See original GitHub issue🐞 bug report
Affected Package
Maybe a cli or ng-packagr or ivy issue.
Is this a regression?
kinda : works with enableIvy: false
, fails with enableIvy: true
Description
Using angular/*@8.0.0-rc.2, and ng new --enable-ivy
fresh projects :
in a testlib
new project, building a mylib
library with ng g library
and ng build
, only adding a ngIf & CommonModule to default lib files produces a bundle that cannot be consumed from a testclient
:
core.js:7182 ERROR Error: Template error: Can't bind to 'ngIf' since it isn't a known property of 'p'.
🔬 Minimal Reproduction
-
use ng cli 8.0.0-rc.2
-
create a lib using ng cli (ng8 rc2, enableIvy=true)
ng new testlib --enable-ivy
(no router, use css)ng g library mylib
- add CommonModule to mylib.module imports
- add an *ngIf to mylib.component
- build the lib using
ng build
-
use it in another project (ng8 rc2, enableIvy=true)
ng new testclient --enable-ivy
(no router, use css)- add this library (copy to node_modules / use yalc / publish to npm…)
- use it : add MylibModule to app.module
- add
lib-mylib
component to app.component.html ng serve
… boom
this fails with enableIvy=true, works with enableIvy=false in testclient
I’ve setup a little repo with minimal reproduction
https://github.com/jmbarbier/ng8-ivy-library-issue
the compiled repro lib is available at https://github.com/jmbarbier/ng8-ivy-library-issue/raw/master/mylib.tar.gz
🔥 Exception or Error
core.js:7182 ERROR Error: Template error: Can't bind to 'ngIf' since it isn't a known property of 'p'.
at createUnknownPropertyError (core.js:12560)
at elementPropertyInternal (core.js:12426)
at Module.ɵɵproperty (core.js:16519)
at MylibComponent_Template (mylib.js:24)
at executeTemplate (core.js:11998)
at checkView (core.js:13349)
at componentRefresh (core.js:13113)
at refreshChildComponents (core.js:11701)
at refreshDescendantViews (core.js:11607)
at checkView (core.js:13350)
🌍 Your Environment
Angular Version:
Angular CLI: 8.0.0-rc.2
Node: 10.15.3
OS: linux x64
Angular: 8.0.0-rc.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.800.0-rc.2
@angular-devkit/build-angular 0.800.0-rc.2
@angular-devkit/build-ng-packagr 0.800.0-rc.2
@angular-devkit/build-optimizer 0.800.0-rc.2
@angular-devkit/build-webpack 0.800.0-rc.2
@angular-devkit/core 8.0.0-rc.2
@angular-devkit/schematics 8.0.0-rc.2
@ngtools/json-schema 1.1.0
@ngtools/webpack 8.0.0-rc.2
@schematics/angular 8.0.0-rc.2
@schematics/update 0.800.0-rc.2
ng-packagr 5.1.0
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Closing this issue as i was able to make it work (with rc.5).
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.