-
Notifications
You must be signed in to change notification settings - Fork 680
Build issue: UglifyJs - Unexpected token: name (context) #566
Comments
Not a maintainer, but this is most likely because uglify doesn't play nice with ES6. Here's a comment summing up the current state nicely. I'm not sure there's a good way to give Webpack a new version of uglify though. You could theoretically use the customizeWebpackConfig option in order to remove the old uglify from the plugins array, and add the new one in but that would be a pretty gnarly solution. |
@hellojere sorry for the delayed response! Did you find a solution to this? It's not clear to me why your custom uglify-js is getting involved since it isn't referenced in the task-config (e.g. in javascripts.production.uglifyJsPlugin). Is it pulled in by react-app? Thanks for that link @brianjhanson, that's really useful info. Does sound like terser could be worth looking into as a solution to this problem. While you're at it, getting Blendid up to 4.5.0 should be pretty painless and will give you a lot of dependency updates, which might help too (the updates are mostly for security, but I suppose there's always the chance that that would introduce some new problem) |
This isn't resolved with a 4.5.0 upgrade. It customizeWebpackConfig wont let you override the default uglify. |
I just hit this on a project that isn't calling anything directly related to uglify in the task config, but happened when I updated an unrelated dependency version semver and I assume something dependant has triggered it. I'm aware blendid is no longer supported, but is there any workaround? |
Sorry to hear that. To my knowledge no Viget dev ever hit this on our Blendid-based projects, so it's encouraging to hear that it could be related to an interaction with unrelated tools. If it turns out it can be alleviated by a change to Blendid, that would be a very welcome PR! Sounds a like a good place to start is digging into that upgrade's package-lock.json / yarn.lock changes. patch-package is a useful tool for hacking on third party dependencies while experimenting. And if you haven't checked it out already, the link from brianjhanson has a good rundown of uglify+webpack troubles — couple years old but then so is much of Blendid |
Jumped back to an older Ruby on Rails project that runs on Blendid, has React baked in, and without doing anything to my own code I started getting the following during the build to production:
I even tried a fresh clean install with Blendid, but this has the same issue.
My
task-config.js
is the following:And my
package.json
:The text was updated successfully, but these errors were encountered: