You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Production library build uses ng-package.json rather than ng-package.prod.json
ng new my-project
cd my-project
ng generate library my-lib
ng build my-lib --prod
Renaming ng-package.json causes an ng-packagr error
Rename ng-package.json to ng-package-dev.json (or any other desired name)
Modify the angular.json build.options.project setting accordingly
ng build my-lib
Observed behavior
The default library generation and angular.json settings imply that it's possible to use a separate ng-package.prod.json file to configure production builds of the library. However, ng-packagr seems to only recognize the file name ng-package.json. Building with the --prod flag uses ng-package.json if present, no matter what the angular.json configuration specifies. In the repro above, the built library is output to dist/my-lib rather than dist/lib. Also, if any settings such as "lib.umdId" are modified in the production configuration, those settings aren't used.
Additionally, if ng-package.json is renamed, ng-packagr throws the error below when building the library. (Note that if ng-package.json is not present, the production configuration is used, but throws the same error, specifying the production ng-package file.)
BUILD ERROR
Trying to read a package from unsupported file extension. Path=C:\src\AngularTest\my-project\projects\my-lib\ng-package-dev.json
Error: Trying to read a package from unsupported file extension. Path=C:\src\AngularTest\my-project\projects\my-lib\ng-package-dev.json
at Object.<anonymous> (C:\src\AngularTest\my-project\node_modules\ng-packagr\lib\ng-v5\discover-packages.js:67:15)
at Generator.next (<anonymous>)
at fulfilled (C:\src\AngularTest\my-project\node_modules\ng-packagr\lib\ng-v5\discover-packages.js:4:58)
at <anonymous>
Desired behavior
The ng-generated library and angular.json settings probably shouldn't include an ng-package.prod.json file or separate "production.project" configuration for building a library, since this isn't currently supported by ng-packagr.
This isn't a critical issue, since the build works fine with ng-package.json, and I don't have a specific use-case for a separate production configuration, but it is somewhat misleading.
The text was updated successfully, but these errors were encountered:
Versions
Repro steps
Production library build uses
ng-package.json
rather thanng-package.prod.json
ng new my-project
cd my-project
ng generate library my-lib
ng build my-lib --prod
Renaming
ng-package.json
causes an ng-packagr errorng-package.json
tong-package-dev.json
(or any other desired name)angular.json
build.options.project setting accordinglyng build my-lib
Observed behavior
The default library generation and
angular.json
settings imply that it's possible to use a separateng-package.prod.json
file to configure production builds of the library. However, ng-packagr seems to only recognize the file nameng-package.json
. Building with the--prod
flag usesng-package.json
if present, no matter what theangular.json
configuration specifies. In the repro above, the built library is output todist/my-lib
rather thandist/lib
. Also, if any settings such as "lib.umdId" are modified in the production configuration, those settings aren't used.Additionally, if
ng-package.json
is renamed, ng-packagr throws the error below when building the library. (Note that ifng-package.json
is not present, the production configuration is used, but throws the same error, specifying the productionng-package
file.)Desired behavior
The ng-generated library and
angular.json
settings probably shouldn't include anng-package.prod.json
file or separate "production.project" configuration for building a library, since this isn't currently supported by ng-packagr.This isn't a critical issue, since the build works fine with
ng-package.json
, and I don't have a specific use-case for a separate production configuration, but it is somewhat misleading.The text was updated successfully, but these errors were encountered: