0.0.4 • Published 7 years ago

rollup-plugin-optimize-js v0.0.4

Weekly downloads
11
License
MIT
Repository
github
Last release
7 years ago

rollup-plugin-optimize-js

NPM Travis

Run your Rollup bundles through optimize-js post minifying.

This will optimize a JavaScript file for faster initial execution and parsing, by wrapping all immediately-invoked functions or likely-to-be-invoked functions in parentheses. By default Rollup does similar optimizations, however, this will apply the optimization to all functions, and/or handle situations where minifying your bundle undos previous optimizations.

See optimize-js for more info and details on when it makes sense for this optimization.

Demo


Usage Example

Install

npm i rollup-plugin-optimize-js --save

Use plugin in your rollup.config.js, be sure to add after uglify

const buble = require('rollup-plugin-buble')
const uglify = require('rollup-plugin-uglify')
const optimizeJs = require('rollup-plugin-optimize-js')

module.exports = {
  entry: 'src/index.js',
  plugins: [
    buble(),
    uglify({
      "compress": {
        "negate_iife": false, // not required, similar optimization
        // omitted for brevity
      }
    }),
    optimizeJs() // occurs after uglify
  ],
  targets: [
    {
      sourceMap: true,
      format: 'iife'
    }
  ]
}

Thanks

Nolan Lawson for the excellent JavaScript

License

MIT

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago