-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uglify throwing an error with 7.0.0 #5186
Comments
Yes @jcbreel I started experiencing this last night also when getting ready to deploy & needed to downgrade back to 6.10.0. Everything looked ok locally in my dev build, but when i ran it through my prod webpack-html minifying & uglifyjs-webpack-plugin pipeline (with relatively minimal but tested config on webpack 3.11.0), i couldn't get past this issue and one other one which i believe was related to use of object assignments in default values for function args in ES6 like:
Neglected to save the output before downgrading, can try reproducing later. I'd suppose this is due to uglifyjs-webpack-plugin not capable of parsing es2015/es6 features, but even after transforming the core playerjs with babel it doesnt seem to be succeeding. I'm a little out-of-my-depth going much further into it, perhaps i'm required to do the webpack 4 upgrade i've been avoiding lol, not sure though. Maybe @gkatsev or @mjneil can help shed light. |
We do use ES6 syntax in source code but we use babel to compile it all down to es5 code. We do have a pkg.module file pointing at an es modules code that webpack potentially is using, but webpack should know how to handle es modules. Maybe something unexpected snuck through? |
I just tried using webpack 4 and it seems to work for the most part, except for uglify using an unsafe transform by default that can cause issues with typeof expressions. |
@gkatsev thanks for the quick response, here's the generic error uglify spits out for me, after setting mangle to false & beautify to true.
this is my uglify config:
|
which seems fine but perhaps the illegal assignment is on the line above,
|
@gkatsev strange but it seems like everything up to that line is transpiled to ES5 but everything afterwards is ES6. I've also just upgraded to 7.0.1. |
@gkatsev I take that back, after that line 11289 it's ES6 for a bit, then goes back to ES5 here: |
Oh, looks like our mpd-parser in VHS isn't using babel for the es build and that's probably what's being used. I'll look into it, nice catch @nypinstripes |
np, @gkatsev after doing the webpack 4.8.3 upgrade, everything's building smoothly in UglifyJS webpack plugin with 7.0.1. |
webpack 4 uses uglify-es, so, it can handle minifying es6 code. Going to work on fixing it on our end also. |
Looks like mpd-parser (videojs/mpd-parser#25) already had this change just needs a release and I made a PR for VHS (videojs/http-streaming#97). |
Both have been released, going to update vjs to latest VHS which should fix this. |
Upgrade to 1.0.2 which contains babel build fixes. Fixes #5186
Upgrade to 1.0.2 which contains babel build fixes. Fixes #5186
So should I just update to latest? What version exactly? Thanks for looking at this guys. |
Description
I'm using Uglify with Webpack and if I use v7.0.0 I get the following error when trying to uglify my code:
ERROR in 0.js from UglifyJs Unexpected token: punc (,) [0.js:45921,41]
Anyone experiencing this?
The text was updated successfully, but these errors were encountered: