Gathering detailed insights and metrics for rollup-plugin-terser
Gathering detailed insights and metrics for rollup-plugin-terser
Gathering detailed insights and metrics for rollup-plugin-terser
Gathering detailed insights and metrics for rollup-plugin-terser
Rollup plugin to minify generated bundle
npm install rollup-plugin-terser
Typescript
Module System
69.1
Supply Chain
96.8
Quality
77.7
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
750,613,243
Last Day
228,978
Last Week
2,583,549
Last Month
14,921,437
Last Year
202,989,131
611 Stars
86 Commits
55 Forks
3 Watching
2 Branches
16 Contributors
Minified
Minified + Gzipped
Latest Version
7.0.2
Package Id
rollup-plugin-terser@7.0.2
Size
3.56 kB
Publised On
04 Sept 2020
Cumulative downloads
Total Downloads
Last day
-65.2%
228,978
Compared to previous day
Last week
-27.5%
2,583,549
Compared to previous week
Last month
-11.5%
14,921,437
Compared to previous month
Last year
-6.3%
202,989,131
Compared to previous year
1
4
Rollup plugin to minify generated es bundle. Uses terser under the hood.
1yarn add rollup-plugin-terser --dev 2# Or with npm: 3npm i rollup-plugin-terser --save-dev
Note: this package requires rollup@0.66 and higher (including rollup@2.0.0)
1import { rollup } from "rollup"; 2import { terser } from "rollup-plugin-terser"; 3 4rollup({ 5 input: "main.js", 6 plugins: [terser()], 7});
⚠️ Caveat: any function used in options object cannot rely on its surrounding scope, since it is executed in an isolated context.
1terser(options);
options
- terser API options
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.numWorkers: number
Amount of workers to spawn. Defaults to the number of CPUs minus 1.
1// rollup.config.js 2import { terser } from "rollup-plugin-terser"; 3 4export default { 5 input: "index.js", 6 output: [ 7 { file: "lib.js", format: "cjs" }, 8 { file: "lib.min.js", format: "cjs", plugins: [terser()] }, 9 { file: "lib.esm.js", format: "esm" }, 10 ], 11};
If you'd like to preserve comments (for licensing for example), then you can specify a function to do this like so:
1terser({ 2 output: { 3 comments: function (node, comment) { 4 var text = comment.value; 5 var type = comment.type; 6 if (type == "comment2") { 7 // multiline comment 8 return /@preserve|@license|@cc_on/i.test(text); 9 } 10 }, 11 }, 12});
Alternatively, you can also choose to keep all comments (e.g. if a licensing header has already been prepended by a previous rollup plugin):
1terser({ 2 output: { 3 comments: "all", 4 }, 5});
See Terser documentation for further reference.
MIT © Bogdan Chadkin
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/30 approved changesets -- score normalized to 2
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
27 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More