When running the following command in my Angular app:
> ng build --prod --aot --env=staging
I encounter this error message:
ERROR in vendor.0625f773941bc83e6748.bundle.js from UglifyJs
Unexpected token operator «*», expected punc «(» [vendor.0625f773941bc83e6748.bundle.js:69512,51]
The issue seems to be related to a npm package called web-request, which I recently installed.
Within the npm-installed index.js
file, there are functions like the one shown below:
function get(uri, options) {
return __awaiter(this, void 0, void 0, function* () { return yield create(uri, Object.assign({}, options, { method: 'GET' })).response; });
}
It appears that Uglify does not support the function*
syntax. Since the index.js
file is not part of the source code of the npm package, how can I resolve this error?
Here is the content of my tsconfig.json
file:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}