rollup-plugin-jspacker
Rollup plugin to minify generated bundle (based on terser with checksum signature enhance)
Last updated 6 months ago by allex .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rollup-plugin-jspacker 
SYNC missed versions from official npm registry.

rollup-plugin-jspacker Travis Build Status

Rollup plugin to minify generated bundle. Based on rollup-plugin-terser. Rollup plugin to minify generated bundle (based on terser with checksum signature enhance)

Install

yarn add rollup-plugin-jspacker --dev

Note: this package requires rollup@0.66 and higher (including rollup@1.0.0)

Usage

import { rollup } from "rollup";
import { minify } from "rollup-plugin-jspacker";

rollup({
  input: "main.js",
  plugins: [minify()]
});

Why named export?

  1. Module is a namespace. Default export often leads to function/component per file dogma and makes code less maintainable.
  2. Interop with commonjs is broken in many cases or hard to maintain.
  3. Show me any good language with default exports. It's historical javascriptism.

Options

see https://github.com/TrySound/rollup-plugin-terser#options

Examples

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:

// rollup.config.js
import { minify } from "rollup-plugin-jspacker";

export default {
  input: "index.js",
  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'  }
  ],
  plugins: [
    minify({
      include: [/^.+\.min\.js$/, '*esm*'], 
      exclude: [ 'some*' ]
    })
  ]
};

See Terser documentation for further reference.

License

MIT © Allex Wang

Current Tags

  • 1.0.2-alpha.2                                ...           alpha (6 months ago)
  • 1.0.2                                ...           latest (6 months ago)

5 Versions

  • 1.0.2                                ...           6 months ago
  • 1.0.2-alpha.2                                ...           6 months ago
  • 1.0.2-alpha.1                                ...           6 months ago
  • 1.0.2-alpha                                ...           6 months ago
  • 1.0.1                                ...           6 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |