webpack: Unable to disable comment preserving in uglifyjs plugin

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

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Yes that’s a bug… Workaround: new webpack.optimize.UglifyJsPlugin({ output: {comments: false} })

Look at this mess:

!function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l
  !*** ./~/lodash/lodash.js ***!
  \****************************/
function(e,t,n){(function(e,r){var o;(function(){function i(e,t){return e.set(t[0],t[1]),e}function a(e,t){return e.add(t),e}function
  !*** ./src/client/environment.ts ***!
  \***********************************/
function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=null},/*!************************************
  !*** ./src/client/components/Component.ts ***!
  \********************************************/
function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&func
  !*** ./~/react/react.js ***!
  \**************************/

So many comments that I dont need!

btw. it’s intended that webpack preserves some comments. This is for legal reasons. By default comments with @license, @preserve or starting with /*! are preserved.