-
-
Notifications
You must be signed in to change notification settings - Fork 181
Webpack 4.x Mangling issue #234
Comments
Why this should be different between |
Updating to 1.2.0 doesn't seem to work either. Still get stuff like The options are the same, and yet the output differs (at least in class names, for some reason): new UglifyJSPlugin({
uglifyOptions: {
warning: "verbose",
ecma: 6,
beautify: false,
compress: false,
comments: false,
mangle: false,
toplevel: false,
keep_classnames: true,
keep_fnames: true
}
}) It's really late here (4:40am), so for now I can only reference the repository branches: https://github.com/scarlettgamestudio/scarlett-framework/tree/pr/webpackV4 uses webpack 4.x, and sets If you have the time to test it, run |
Could you try with |
Could this file be the problem: https://github.com/scarlettgamestudio/scarlett-framework/blob/pr/webpackV4/config/addons/webpack.uglifyes6.js |
Just tried, but the result is the same. I'll try to determine the real reason or create a simpler user case, as only some classes have the problem (with webpack 4.x + uglifyjs plugin). That file you mentioned is only used with the webpack 3.x branch via the env variable in the script. Thanks! |
Was able to reproduce/isolate the issue within a way smaller repository using I basically mirrored what's happening in the other one (see After running I'll keep investigating 😄 Edit: Hmmm. Removing the import of class For instance, importing So basically, it's not affecting isolated classes, but rather the ones that are dependent on others. Edit 2: It seems to be happening only with |
@Apidcloud thanks for minimum reproducible test repo! |
You're welcome 😄 I've branched out the issue so you can keep testing in the same repository: https://github.com/Apidcloud/scarlett-blast/tree/issueWebpack |
/cc @kzc |
It's most likely a webpack 4 module hoisting and/or export renaming issue from the description. I'm not going to build either project, but you can verify it by disabling uglify and searching the resultant webpack output for See also: webpack/webpack#5463 (comment) By the way, I don't follow the uglify project any longer. If you think it's an uglify issue submit a bug report to that project with a self contained JS input file with no third party tools/libraries/webpack involved. |
In one of my latest replies, I mentioned that I don't think it's an uglify js issue, as it works well with webpack 3.x, but it doesn't with webpack 4.x 'production' mode. But I only found out that 2 days ago and thus creating the issue here. Also, that's precisely why I linked https://github.com/Apidcloud/scarlett-blast/tree/issueWebpack There are no third party tools or libraries involved in there. Classes have nothing inside. |
Set |
I'm also experiencing problem with passing
But I get
from Webpack. I though that the options should be sent to |
@kontrollanten Are you requiring the plugin from |
No, I tried that now though. But then I get
And when try without
Edit: Typo error :-) When I import |
Please show the relevant part of your |
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
...
optimization: {
minimizer: [
new UglifyJSPlugin({
uglifyOptions: { ... }
})
]
} Doesn't work ? |
It seems that the following is working. The exception was thrown through offline-plugin.
Now I have a lot of other errors thrown from other plugins. The investigation continues. Thanks for your quick response and a great plugin! |
Look at: |
I needed to upgrade offline-plugin -- a relevant issue was fixed at 5.0.3 I believe. |
Why this issue is closed ? The problem still exists. Mangle can't be disabled. |
@sokra Seems to be problem with webpack, because |
I installed uglifyjs-3-webpack-plugin:
Required it in my const UglifyJsPlugin = require("uglifyjs-3-webpack-plugin"); Now |
guys, i found the solution.
If that is turned on, you end up with classes that are named class_Class and class_OtherClass Minimization is still an issue if you need the class names, but that can be fixed by using the minimizer options. Default production webpack 4 config for me is now:
|
Good evening!
I'm trying to use
webpack 4.x
withuglifyjs
plugin, but I need to disable mangling, which seems to not be working as before. Using v1.1.8 withwebpack 3.11
didn't change class names whenmangle
was set tofalse
; but it is changing them withwebpack 4.x
.The version of the underlying
uglify-es
innode_modules
is 3.3.9 in both cases.What could be the issue?
Here's part of
webpack.config
:Thanks!
Edit: Just to make sure, cleaning yarn's cache didn't help either.
The text was updated successfully, but these errors were encountered: