I am trying to optimize the ng2-smart-table package, which we are using as a dependency, as I have noticed it has a big unnecessary dependency on lodash, even though it only uses a tiny portion of lodash.
However, I'm running into some issues when trying to get webpack bundle analyzer to work with their angular.json
workspace file.
If I just try to run ng build I get this:
❯ ng build --statsJson
Unknown option: '--statsJson'
❯ ng build --stats-json
Unknown option: '--stats-json'
Now, the project uses an angular.json
workspace file with the following contents:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ng2-smart-table": {
"projectType": "library",
"root": "projects/ng2-smart-table",
"sourceRoot": "projects/ng2-smart-table/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/ng2-smart-table/tsconfig.lib.json",
"project": "projects/ng2-smart-table/ng-package.json"
}
},
...
If I try to add "statsJson": true
to the options I get this error:
❯ ng build ng2-smart-table
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(statsJson).
I suspect it has something to do with the project using @angular-devkit/build-ng-packagr:build
rather than the standard @angular-devkit/build-angular:browser
. However, since the packagr apparently doesn't support analysis I just don't know how I can get my analysis file generated.