-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Unable to disable comment preserving in uglifyjs plugin #324
Comments
Yes that's a bug... |
Wow. Thanks for quick reply! Workaround works. |
I have the inverse problem. Uglify is removing comments inside an HTML string and |
Oops, apparently it was the html loader who was realizing there was minification going on and turned it's own minification processes on. I have manually disabled it and everything works. |
Found this post while searching for the same issue. @sokra gave a workaround, which still works. Does it mean it's the right way now and it's not a bug? |
I'm still seeing this issue in latest version of webpack. @sokra's workaround does the trick |
Can confirm that @sokra's workaround is still required for this |
btw. it's intended that webpack preserves some comments. This is for legal reasons. By default comments with |
@WickyNilliams @NomNomCameron I tested using Are you sure you're using latest webpack version for both local and global? |
@sokra intersting! what legal reasons? |
@ccorcos you typically want to preserve licenses which are usually at the top as a multi-line comment. |
That's what I'm reading here, but why is that? |
@ccorcos some licenses require it. |
Look at this mess:
So many comments that I dont need! |
microsoft#96 updated the license to zero clause BSD so that bundlers didn't need to keep the license intact. However, the `/*!` still signifies to bundlers such as Webpack, Uglify that they should keep this license intact. https://stackoverflow.com/questions/11248363/the-purpose-of-starting-an-initial-comment-with-in-javascript-and-css-files > This is for legal reasons. By default comments with `@license`, `@preserve` or starting with `/*!` are preserved webpack/webpack#324 (comment)
Comments in bundle can result in issues like this one when wrong line number is reported in tools like Sentry |
Trying to do this:
new webpack.optimize.UglifyJsPlugin({ comments: false })
Setting will be overwritten because of this:
https://github.com/webpack/webpack/blob/master/lib/optimize/UglifyJsPlugin.js#L79
Other reference:
https://github.com/mishoo/UglifyJS2/blob/master/lib/output.js#L62
The text was updated successfully, but these errors were encountered: