Gathering detailed insights and metrics for @ducanh2912/rollup-plugin-terser
Gathering detailed insights and metrics for @ducanh2912/rollup-plugin-terser
Gathering detailed insights and metrics for @ducanh2912/rollup-plugin-terser
Gathering detailed insights and metrics for @ducanh2912/rollup-plugin-terser
Rollup plugin to minify generated bundle with Terser
npm install @ducanh2912/rollup-plugin-terser
Typescript
Module System
Min. Node Version
Node Version
NPM Version
61.2
Supply Chain
92.6
Quality
75.5
Maintenance
100
Vulnerability
99.6
License
TypeScript (53.45%)
JavaScript (44.93%)
Shell (1.62%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,280
Last Day
1
Last Week
2
Last Month
15
Last Year
186
MIT License
122 Commits
1 Branches
1 Contributors
Updated on Nov 29, 2022
Minified
Minified + Gzipped
Latest Version
2.0.0
Package Id
@ducanh2912/rollup-plugin-terser@2.0.0
Unpacked Size
9.45 kB
Size
3.27 kB
File Count
7
NPM Version
8.19.2
Node Version
16.18.0
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-33.3%
2
Compared to previous week
Last Month
-50%
15
Compared to previous month
Last Year
-47.2%
186
Compared to previous year
1
28
Rollup plugin to minify generated bundle with Terser. Uses terser under the hood.
1yarn add @ducanh2912/rollup-plugin-terser --dev
2# Or with npm:
3npm i @ducanh2912/rollup-plugin-terser --save-dev
4# Or with pnpm:
5pnpm i @ducanh2912/rollup-plugin-terser --save-dev
Note: this package requires rollup@2.0.0 and higher
1import { rollup } from "rollup"; 2import { terser } from "@ducanh2912/rollup-plugin-terser"; 3 4rollup({ 5 input: "main.js", 6 plugins: [terser()], 7});
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
1// rollup.config.js 2import { terser } from "@ducanh2912/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 it like so:
1terser({ 2 format: { 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 format: { 3 comments: "all", 4 }, 5});
See Terser's documentation for further reference.
No vulnerabilities found.
No security vulnerabilities found.