run the my project
ng build --prod --base-href="./"
getting below error message
ERROR in ./node_modules/ng-multiselect-dropdown/fesm2015/ng-multiselect-dropdown.js
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
TypeError: Cannot read property 'kind' of undefined
at isAngularDecoratorMetadataExpression (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35)
at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21)
at visitNodes (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16514:30)
at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16740:24)
at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16635:21)
at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16703:24)
at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16692:24)
at checkNodeForDecorators (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
at visitNode (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16505:24)
at Object.forEachChild (/home/gayathri/Desktop/webapp8/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16599:21)
Not a permanent solution, but I was getting this in production only with datepicker. I went to the production configuration in angular.json and changed buildOptimizer to false.
I found it really hard to find information about this error for library builders, so I'm posting it here. We can't just tell the users to upgrade their Angular's versions or disable build optimization.
For a library to work well with versions 6 and 7 of @angular/cli, you must export all decorators metadata when building the library. To do that, add the following to the tsconfig.json
of your lib:
"compilerOptions": {
"emitDecoratorMetadata": true
}
Downgrading the version of ng-multiselect-dropdown to 0.2.3 might solve the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With