This package has been deprecated

Author message:

This package been migrated to rollup-plugin-minimize

rollup-plugin-jspacker
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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

Package Sidebar

Install

npm i rollup-plugin-jspacker

Weekly Downloads

8

Version

1.0.3

License

MIT

Unpacked Size

13.2 kB

Total Files

7

Last publish

Collaborators

  • allex