Type of Issue
[x ] Bug Report
[ ] Feature Request
Description
Unsure if this is an angular-cli issue or ng-packagr.
Have an angular 6 application containing a library project. When I build using ng-packagr directly the resulting npm package can be consumed from another Angular 6 application. When I build using the angular-cli the resulting package cannot be consumed from another Angular 6 application and get multiple errors as follows when trying to build the consuming Angular 6 app:
ERROR in ./node_modules/c-lib/fesm5/c-lib.js
Module not found: Error: Can't resolve ' commonjs-proxy:../../a-service/a.service' in 'C:\data\sandbox\angular\example-ng6-lib-app\node_modules\c-lib\fesm5'
How To Reproduce
- Given the following configuration in angular.json, build the library using the angular cli and then package using npm:
ng build --prod c-lib
cd dist/c-lib && npm pack
angular.json:
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/c-lib/tsconfig.lib.json",
"project": "projects/c-lib/ng-package.json"
},
"configurations": {
"production": {
"project": "projects/c-lib/ng-package.prod.json"
}
}
},
-
Install the library into another angular 6 application and attempt to consume a component from the installed library
-
Build the consuming application
Expected Behaviour
Expect the consuming application to build successfully and consumed component to function correctly.
This expected behaviour is achieved when using ng-packagr directly replacing step 1 above with the following:
ng-packagr -p ./projects/c-lib/ng-package.prod.json
cd dist/c-lib && npm pack
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 4.0.0-rc.0
@angular/compiler: 6.0.0
rollup: 0.59.4
tsickle: 0.27.5
typescript: 2.7.2
Please include all version numbers that might be relevant, e.g. third-party libraries
Type of Issue
Description
Unsure if this is an angular-cli issue or ng-packagr.
Have an angular 6 application containing a library project. When I build using ng-packagr directly the resulting npm package can be consumed from another Angular 6 application. When I build using the angular-cli the resulting package cannot be consumed from another Angular 6 application and get multiple errors as follows when trying to build the consuming Angular 6 app:
ERROR in ./node_modules/c-lib/fesm5/c-lib.js
Module not found: Error: Can't resolve ' commonjs-proxy:../../a-service/a.service' in 'C:\data\sandbox\angular\example-ng6-lib-app\node_modules\c-lib\fesm5'
How To Reproduce
angular.json:
Install the library into another angular 6 application and attempt to consume a component from the installed library
Build the consuming application
Expected Behaviour
Expect the consuming application to build successfully and consumed component to function correctly.
This expected behaviour is achieved when using ng-packagr directly replacing step 1 above with the following:
Version Information
Please include all version numbers that might be relevant, e.g. third-party libraries