ERROR from UglifyJs Unexpected character '@'

ERROR from UglifyJs Unexpected character '@'



I am getting below error when my Angular 6 App build as ng build ---prod


ng build ---prod



ERROR in scripts.28e0dfadf7f39e74e940.js from UglifyJs Unexpected
character '@' [scripts.28e0dfadf7f39e74e940.js:13,0]



What could be the issue?



tsconfig.json



"compileOnSave": false,
"compilerOptions":
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]






do you have any external script defined in your angular.json ?
– YoukouleleY
Aug 23 at 10:12





@YoukouleleY Yeah. node_modules/chart.js/dist/Chart.min.js and a ts file with custom functions for Pipe, PipeTransform
– Bishan
Aug 23 at 10:20



node_modules/chart.js/dist/Chart.min.js


Pipe, PipeTransform





as already answered, you can't import typescript files in there
– YoukouleleY
Aug 23 at 10:27




1 Answer
1



UglifyJS does not support ES2015 or higher. Decorators are not yet part of any ES specification, hence they are not supported. You have to transpile them firstly.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.