I am building a library with Angular 6.1.0
ng new lib-demo
ng generate library my-lib
All the articles advise running the build for the library with a --prod
flag like so:
ng build my-lib --prod
However, this throws an error
Configuration 'production' could not be found in project 'my-lib'.
Which is probably correct because when I look at the angular.json there is no definition for a production build configuration
in the library project. It is present for the application project only.
the following is what I have under the build configuration for library project that uses ng-packagr
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/my-lib/tsconfig.lib.json",
"project": "projects/my-lib/ng-package.json"
}
}
So the question here is that is the --prod
flag not required anymore and just running ng build m-lib
will generate a prod build?
Looking at the contents of dist folder it looks so but I am not 100% sure. If someone could validate this, it will be great.