Encore requires uglifyjs-webpack-plugin in version ^1. This leads to issues when uglifying es2015+ code as only version ^2 supports it.
See https://github.com/webpack/webpack/issues/5858#issuecomment-338144186
Hi @dmolineus,
I don't think that's the case based on this changelog.
After its next release Encore will include webpack 4 and uglifyjs-webpack-plugin ^1.2.5 which uses uglify-es (and thus supports ES6).
If we update uglifyjs-webpack-plugin to 2.x, it will use uglify-js again and ES6 won't be supported anymore.
However what we could do is follow their advice to use terser-webpack-plugin instead. It seems that it's going to replace the uglifyjs-webpack-plugin in Webpack 5.
@Lyrkan Thanks for looking deeper and pointing out that 2.x of uglifyjs-webpack-plugin won't help. Maybe it would be at least useful if a user can disable the default minifying shipped with Encore. So it would be possible to use another tool if required.
Well, the default tool should be changed to be terser-webpack-plugin IMO
I agree. It seems like terser is the future and we should change to it before the next release (because it already contains so many other changes).
Most helpful comment
I agree. It seems like terser is the future and we should change to it before the next release (because it already contains so many other changes).