babel-plugin-dynamic-import-webpack

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

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
Last updated 8 years ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-dynamic-import-webpack 
SYNC missed versions from official npm registry.

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

Via .babelrc (Recommended)

.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.

Current Tags

  • 1.1.0                                ...           latest (8 years ago)

4 Versions

  • 1.1.0 [deprecated]           ...           8 years ago
  • 1.0.2 [deprecated]           ...           8 years ago
  • 1.0.1 [deprecated]           ...           9 years ago
  • 1.0.0 [deprecated]           ...           9 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 4
Dependencies (0)
None
Dev Dependencies (12)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |