GithubHelp home page GithubHelp logo

babel-plugin-iife-wrap's Introduction

babel-plugin-iife-wrap Build Status

Wrap file with iife.

Install

With npm do:

npm i babel-plugin-iife-wrap --D

Example

Input

window.a = 1;

Output

;(function () {
  window.a = 1;
}());

Usage

In your Babel configuration:

{
  "plugins": ["iife-wrap"]
}

Note that Webpack outputs a bundle wrapped with iife by default.

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Bogdan Chadkin

babel-plugin-iife-wrap's People

Contributors

trysound avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

babel-plugin-iife-wrap's Issues

Doesn't work with babel-plugin-transform-es2015-typeof-symbol

I made a gist to demonstrate:
https://gist.github.com/AlexanderOtavka/698b83a1ffab9b2141d01b6cd25753c7

Babel will transpile the js file just fine if either the iife-wrap plugin or the
transform-es2015-typeof-symbol plugin are commented out, but will not work
if they are both present

iife-wrap seems to make transform-es2015-typeof-symbol run twice on the same
code but I am not sure exactly what is going on

See for yourself. Download and unzip the gist, then run
npm install && npm start. It will error. Then comment out one of the two
plugins identified by my comments in the gulpfile. Try npm start again and
watch it compile successfullly, and print "symbol" as it should.

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.