diff --git a/README.md b/README.md index f7302b71..400c9e77 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">

UglifyJS Webpack Plugin

-

This plugin uses UglifyJS v2 to minify your JavaScript.

+

This plugin uses UglifyES v3 to minify your JavaScript.

> Note that webpack contains the same plugin under `webpack.optimize.UglifyJsPlugin`. This is a standalone version for those that want to control the version of UglifyJS. The documentation is valid apart from the installation instructions in that case. @@ -31,20 +31,6 @@ With npm: npm install uglifyjs-webpack-plugin --save-dev ``` -**Important!** The plugin has a peer dependency to uglify-js, so in order to use the plugin, also uglify-js has to be installed. The currently (2017/1/25) available uglify-js npm packages; however, do not support minification of ES6 code. In order to support ES6, an ES6-capable, a.k.a. _harmony_, version of UglifyJS has to be provided. - -If your minification target is ES6: - -```bash -yarn add git://github.com/mishoo/UglifyJS2#harmony-v2.8.22 --dev -``` - -If your minification target is ES5: - -```bash -yarn add uglify-js --dev -``` -

Usage

```javascript diff --git a/package.json b/package.json index d3d72e78..f5ca588d 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ }, "dependencies": { "source-map": "^0.5.6", - "uglify-js": "^2.8.29", + "uglify-es": "^3.0.19", "webpack-sources": "^1.0.1" }, "devDependencies": { diff --git a/src/index.js b/src/index.js index 30ede3f5..f3bf6c9e 100644 --- a/src/index.js +++ b/src/index.js @@ -10,7 +10,7 @@ const RawSource = require("webpack-sources").RawSource; const ConcatSource = require("webpack-sources").ConcatSource; const RequestShortener = require("webpack/lib/RequestShortener"); const ModuleFilenameHelpers = require("webpack/lib/ModuleFilenameHelpers"); -const uglify = require("uglify-js"); +const uglify = require("uglify-es"); class UglifyJsPlugin { constructor(options) { diff --git a/yarn.lock b/yarn.lock index c000207e..b2b63247 100644 --- a/yarn.lock +++ b/yarn.lock @@ -950,7 +950,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@^2.8.1: +commander@^2.8.1, commander@~2.9.0: version "2.9.0" resolved "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -3655,7 +3655,14 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -uglify-js@^2.6, uglify-js@^2.8.27, uglify-js@^2.8.29: +uglify-es@^3.0.19: + version "3.0.19" + resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.0.19.tgz#53d448ddf59770c1eafbe2e257a27e2f4851d0e5" + dependencies: + commander "~2.9.0" + source-map "~0.5.1" + +uglify-js@^2.6, uglify-js@^2.8.27: version "2.8.29" resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" dependencies: