You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building production using ng build --prod results with the following error: ERROR in vendor.6524f61fda4d53a6f933.bundle.js from UglifyJs Unexpected token: name (Time) [vendor.6524f61fda4d53a6f933.bundle.js:18068,6]
I can't find Time in my project path, i think it is from some of the libraries i use.
Before i updated Angular, and Angular CLI
I used Angular 4.1.3 and Angular CLI 1.0.6 and I was getting similar error but insted of Time, unexpected token was PolicyMappings which was from pkijs
ERROR in main.1dae05ad85948e9171be.bundle.js from UglifyJs
Unexpected token: name (TaskTableComponent) [main.1dae05ad85948e9171be.bundle.js:53,6]
``
In my case, `TaskTableComponent` is a component defined in my app, loaded in the module
import { TaskTableComponent } from './task-table/task-table.component';
and I get no errors in dev mode (the component also works just fine)
I may have found the problem - I had a target of es6, because es5 was causing me problems with this.allowedFields = [ ...new Set(this.allowedFields) ].sort((a,b) => { return a.toLowerCase() > b.toLowerCase() ? 1 : -1});
I think that es6 does not compile properly with uglify.js , which may be throwing out the errors
Any idea on how I can get uglify to work with es6 ?
Reacted by Philip Waritschlager and Francesco Borzì
I have compilerOptions.target of es5 and still have ERROR from UglifyJS. I figured it's because I'm using pify package that's ES6. Still haven't found a solution yet.
Reacted by amit, Daan Geerdink, toregua and Firenze11
I have the same issue, with a library required by AutobahnJS called cbor. There I get this error when trying to build with --prod:
ERROR in vendor.f46aa55cec82811ad623.bundle.js from UglifyJs
Unexpected token: name (Decoder) [[...]/node_modules/cbor/lib/decoder.js:48,0][vendor.f46aa55cec82811ad623.bundle.js:23235,6]
Same problem for me with quilljs when i try to create a custom theme based on snow theme, when i run "ng build --prod" :
ERROR in main.b5edce071b49acaa29f7.bundle.js from UglifyJs
Unexpected token: name (MyCustomTheme) [main.b5edce071b49acaa29f7.bundle.js:30679,6]
ERROR in vendor.f179b6171896e95f4169.bundle.js from UglifyJs
Unexpected token: name (debug) [vendor.f179b6171896e95f4169.bundle.js:16561,4]
Activity
sumitarora commentedon Jun 13, 2017
@AKuzmanoski Are you getting any errors while running the dev build?
alkuzman commentedon Jun 13, 2017
No, it works fine on dev mode
jmls commentedon Jun 16, 2017
I've started hitting this -
import { TaskTableComponent } from './task-table/task-table.component';
alkuzman commentedon Jun 16, 2017
Can you share some details abot TaskTableComponent?
jmls commentedon Jun 16, 2017
I may have found the problem - I had a target of es6, because es5 was causing me problems with
this.allowedFields = [ ...new Set(this.allowedFields) ].sort((a,b) => { return a.toLowerCase() > b.toLowerCase() ? 1 : -1});I think that es6 does not compile properly with uglify.js , which may be throwing out the errors
Any idea on how I can get uglify to work with es6 ?
marino-andriamialy commentedon Jul 11, 2017
I've resolved this using UglifyJS2#harmony-v2.8.22 --dev for ES6:
yarn add git://github.com/mishoo/UglifyJS2#harmony-v2.8.22 --dev
documented at: https://www.npmjs.com/package/uglifyjs-webpack-plugin
alexander-kovalev commentedon Jul 27, 2017
I changed compilerOptions.target from es6 to es5 and this error disappeared.
kirillgroshkov commentedon Aug 10, 2017
I have compilerOptions.target of es5 and still have ERROR from UglifyJS. I figured it's because I'm using
pifypackage that's ES6. Still haven't found a solution yet.daangeerdink commentedon Aug 18, 2017
I have the same issue, with a library required by AutobahnJS called cbor. There I get this error when trying to build with
--prod:Anyone have a solution?
toregua commentedon Aug 22, 2017
Same problem for me with quilljs when i try to create a custom theme based on snow theme, when i run "ng build --prod" :
Please give us a solution/workaround
wingsbob commentedon Sep 12, 2017
I think all these issues are supposed to be gathered in #2907
FrancescoBorzi commentedon Nov 13, 2017
I can confirm this issue. Only happens when I set the target to
es6. Usinges5the issue is not there.anhmaker commentedon Dec 22, 2017
I changed compilerOptions.target from es6 to es5 and OK too.
hubert17 commentedon Dec 29, 2017
I as well can confirm that you can't switch back the target to es5 if you have package like SignalR core which propably uses es6.
wingsbob commentedon Dec 29, 2017
Upgrade to a newer version of angular-cli, this has been fixed for a little while now: #7610
Matches signalr version with server and upgrades angular cli
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.