Skip to content

Commit

Permalink
Tweak docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed May 19, 2017
1 parent 89449f8 commit 251d57b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import { rollup } from 'rollup';
import uglify from 'rollup-plugin-uglify';

rollup({
entry: 'main.js',
plugins: [
uglify()
]
entry: 'main.js',
plugins: [
uglify()
]
});
```

Expand All @@ -37,24 +37,26 @@ uglify(options, minifier)

## Warning

[UglifyJS](https://github.com/mishoo/UglifyJS2), which this plugin is based on, does not support the ES2015 module syntax. Thus using this plugin with Rollup's default bundle format (`'es6'`) will not work and error out.
To work around this you can tell `rollup-plugin-uglify` to use the UglifyJS [harmony branch](https://github.com/mishoo/UglifyJS2/tree/harmony) by passing its `minify` function to minify your code.
[UglifyJS](https://github.com/mishoo/UglifyJS2), which this plugin is based on, does not support the ES2015 module syntax. Thus using this plugin with Rollup's default bundle format (`'es'`) will not work and error out.
To work around this you can tell `rollup-plugin-uglify` to use the UglifyJS [unstable es version](https://github.com/mishoo/UglifyJS2) by passing its `minify` function to minify your code.
```js
import { rollup } from 'rollup';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-js-harmony';
import { minify } from 'uglify-es';

rollup({
entry: 'main.js',
plugins: [
uglify({}, minify)
]
entry: 'main.js',
plugins: [
uglify({}, minify)
]
});
```

To install the experimental version of UglifyJS:

npm i -D uglify-js-harmony
```
npm i uglify-es -D
```

## Examples

Expand Down

0 comments on commit 251d57b

Please sign in to comment.