Socket
Socket
Sign inDemoInstall

babel-plugin-transform-ensure-ignore

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-transform-ensure-ignore

require.ensure ignore


Version published
Weekly downloads
389
decreased by-20.77%
Maintainers
1
Install size
8.24 kB
Created
Weekly downloads
 

Readme

Source

babel-plugin-transform-ensure-ignore

Build Status NPM Dependencies License

require.ensure is cool, but we don't need it in Node env.

see more https://webpack.github.io/docs/code-splitting.html#defining-a-split-point

this plugin will help to transform code below:

require.ensure([], (require) => {
  require.include('./some-module');
  require('./some-module');
});

to

require('./some-module');

Configure it in .babelrc for node, we could ignore the requirement when run test in node or build server render app. Then we run babel with BABEL_ENV=node will active this plugin;

{
  "env": {
    "node": {
      "plugins": [
        "babel-plugin-transform-ensure-ignore"
      ]
    }
  }
}

or use with babel-register in require-hooks

require('babel-register')({
  'plugins': [
     'babel-plugin-transform-ensure-ignore'
  ]
});

Or with cli like other plugin used.

Notice:

  • Don't use this in webpack system
  • make sure the correct usage of require.ensure

Keywords

FAQs

Last updated on 05 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc