1
votes

Its working fine when i do ng serve and normal ng build. But when i try to build project as ng build --prod its throwing me error as below

ERROR in ./node_modules/ngx-doc-viewer/fesm2015/ngx-doc-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:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:265:35) at checkNodeForDecorators (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:77:21) at visitNodes (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16514:30) at Object.forEachChild (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16740:24) at checkNodeForDecorators (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16505:24) at Object.forEachChild (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16635:21) at checkNodeForDecorators (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16505:24) at Object.forEachChild (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16703:24) at checkNodeForDecorators (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16505:24) at Object.forEachChild (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16692:24) at checkNodeForDecorators (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31) at visitNode (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16505:24) at Object.forEachChild (C:\Users\vicky\Documents\RND-Project\Angular\docPreview\node_modules\typescript\lib\typescript.js:16599:21)

2

2 Answers

1
votes

As mentioned by the owner of the library here

ng update @angular/cli 

solves the problem.

0
votes

I won't recommend it as a permanent solution, but can you try building like this :

ng build --prod --aot false --build-optimizer false