When build project with out uglify, everything is working fine. but when i try uglify in production build application is not functioning properly. webpack version 1.13.1
2 thoughts on “Uglify not working properly in production build.”
Comments are closed.
@umasgn it is not very polite to open an issue on a project called “Webpack” claiming in the title another project “Uglify” (yes UglifyJS is a separate project) doesn’t work and putting almost no effort into explaining the problem. UglifyJS is a separate project – even the UglifyJS plug-in is not webpack but a plug-in.
Since quite a large community is using this combination with success every day its very likely that the issue is the code you’re trying to minify.
Just a few questions which you could have provided answers for in your very first attempt:
Angular team did not take into consideration what UglifyJS docs tell you: you shouldn’t rely on
Function.name
when mangling your code, because mangling is what shortens long names – including function names – to a, b or c. So assuming a function to have a particular name after mangling just fails. Now you also know why your code doesn’t get so much minified anymore after settingmangle: false
: because you actually disabled minification.However the UglifyJS developers were clever enough to provide an option letting you exclude function names from mangling: by researching you find
mangle: true
together withkeep_fnames=true
may produce minified code that runs. Go try it out. If it works, please be at least polite enough to come back and tell webpack people that they can close this issue.Can you elaborate?