x)- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [x] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request
Angular version: 8.0.2
ng2-pdf-viewer version: 6.1.2
When doing ng build everything works, but when trying to do ng build --prod I get this error:
ERROR in ./node_modules/ng2-pfd-viewer/fesm5/ng2-pdf-viewer.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 (C:\Projects\test_project\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:77:21)
Hey YazanGhishan,
I was having the same problem and solve it using [email protected].
Hope it helps you!
@VadimDez I think this is the solution for buildOptimizer build issue:
https://stackoverflow.com/a/60887133/213050
Can you please try it?
Basically the lib needs to emit decorator metadata with some tsconfig.json change like this
"compilerOptions":{
"emitDecoratorMetadata": true
}
We are trying to optimize our bundle sizes and this issue came up with ng2-pdf-viewer
Thanks!
Actually I upgraded my project to Angular 9 and now I do not see that issue anymore.
Downgrading to v5.3.4 worked for me
npm uninstall ng2-pdf-viewer
then
npm install [email protected]
After searching for a long time, this worked for me. Upgraded @angular-devkit/build-angular to version: "~0.803.19" and then prod build worked fine. Made the following change in package.json.
`
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.19",
...
}
`
Please change your angular-devkit dependencies to latest version in the package.josn file:
I have changed version in below dependencies and its worked with the --prod command
"devDependencies": { "@angular-devkit/architect": "~0.803.20", "@angular-devkit/build-angular": "~0.803.20", "@angular-devkit/core": "~8.3.20", "@angular-devkit/schematics": "~8.3.20", }
This solution working like charm :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Downgrading to v5.3.4 worked for me
npm uninstall ng2-pdf-viewerthen
npm install [email protected]