rollup-plugin-terser
Advanced tools
Comparing version 5.2.0 to 5.3.0
{ | ||
"name": "rollup-plugin-terser", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "Rollup plugin to minify generated es bundle", | ||
@@ -41,3 +41,3 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"rollup": ">=0.66.0 <2" | ||
"rollup": ">=0.66.0 <3" | ||
}, | ||
@@ -50,4 +50,4 @@ "devDependencies": { | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.29.0" | ||
"rollup": "^2.0.0" | ||
} | ||
} |
@@ -14,3 +14,3 @@ # rollup-plugin-terser [![Travis Build Status][travis-img]][travis] | ||
*Note: this package requires rollup@0.66 and higher (including rollup@1.0.0)* | ||
_Note: this package requires rollup@0.66 and higher (including rollup@1.0.0)_ | ||
@@ -35,3 +35,2 @@ ## Usage | ||
## Options | ||
@@ -47,2 +46,7 @@ | ||
Note: some terser options are set by the plugin automatically: | ||
- `module: true` is set when `format` is `esm` or `es` | ||
- `toplevel: true` is set when `format` is `cjs` | ||
`options.sourcemap: boolean` | ||
@@ -56,3 +60,2 @@ | ||
`options.include: Array<string | RegExp> | string | RegExp` | ||
@@ -62,7 +65,2 @@ | ||
Note: some terser options are set by the plugin automatically: | ||
* `module: true` is set when `format` is `esm` or `es` | ||
* `toplevel: true` is set when `format` is `cjs` | ||
Specifically include/exclude chunk files names (minimatch pattern, or array of minimatch patterns), By default all chunk files will be minify. | ||
@@ -72,3 +70,20 @@ | ||
### Using as output plugin | ||
```js | ||
// rollup.config.js | ||
import { terser } from "rollup-plugin-terser"; | ||
export default { | ||
input: "index.js", | ||
output: [ | ||
{ file: "lib.js", format: "cjs" }, | ||
{ file: "lib.min.js", format: "cjs", plugins: [terser()] }, | ||
{ file: "lib.esm.js", format: "esm" } | ||
] | ||
}; | ||
``` | ||
### include/exclude | ||
If you'd like that only some of the files will be minify, then you can filter by `include` and `exclude` to do this like so: | ||
@@ -83,11 +98,11 @@ | ||
output: [ | ||
{ file: 'lib.js', format: 'cjs' }, | ||
{ file: 'lib.min.js', format: 'cjs' }, | ||
{ file: 'lib.esm.js', format: 'es' }, | ||
{ dir: '.', entryFileNames: 'lib-[format].js', format: 'iife' } | ||
{ file: "lib.js", format: "cjs" }, | ||
{ file: "lib.min.js", format: "cjs" }, | ||
{ file: "lib.esm.js", format: "esm" }, | ||
{ dir: ".", entryFileNames: "lib-[format].js", format: "iife" } | ||
], | ||
plugins: [ | ||
terser({ | ||
include: [/^.+\.min\.js$/, '*esm*'], | ||
exclude: [ 'some*' ] | ||
include: [/^.+\.min\.js$/, "*esm*"], | ||
exclude: ["some*"] | ||
}) | ||
@@ -94,0 +109,0 @@ ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9883
140