Giter Site home page Giter Site logo

ezekielchentnik / rollup-plugin-optimize-js Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 21 KB

Rollup plugin to easily run your bundles through optimize-js post minifying

License: MIT License

JavaScript 100.00%
rollup rollup-plugin optimize-js iife uglifyjs

rollup-plugin-optimize-js's Introduction

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.


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

rollup-plugin-optimize-js's People

Contributors

ezekielchentnik avatar

Watchers

 avatar  avatar

rollup-plugin-optimize-js's Issues

sourcemaps!

It's sort of working, but when I remove this it works so much better!

Also, the options aren't getting passed through, sourcemaps are just always on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.