You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

babel-plugin-dynamic-import-webpack

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-dynamic-import-webpack

Babel plugin to transpile import() to require.ensure, for Webpack


Version published
Weekly downloads
26K
increased by4.77%
Maintainers
3
Created
Weekly downloads
 

Changelog

Source

v1.1.0

  • [New] Removes dependency on babel-template and babel-plugin-syntax-dynamic-import (#51)

Readme

Source

babel-plugin-dynamic-import-webpack

Babel plugin to transpile import() to require.ensure, for Webpack.

Note that Webpack 2 has gotten import() after this code was written.

NOTE: Babylon v6.12.0 is required to correctly parse dynamic imports.

Installation

$ npm install babel-plugin-dynamic-import-webpack --save-dev

Usage

.babelrc

{
  "plugins": ["dynamic-import-webpack"]
}

Via CLI

$ babel --plugins dynamic-import-webpack script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["dynamic-import-webpack"]
});

Dynamic imports and webpack

Although the specification for import() supports a dynamic importing of modules in the browser runtime, webpack's require.ensure() is not dynamic and requires a hardcoded string to work correctly. For more information see webpack's documentation on dynamic requires.

Keywords

FAQs

Package last updated on 08 Oct 2018

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc