babel-plugin-dynamic-import-split-require

2.0.0 • Public • Published

babel-plugin-dynamic-import-split-require

babel plugin to compile import() syntax to split-require, the commonjs bundle splitting library

v2+ of this plugin works with split-require@3.1.0 and up. Install babel-plugin-dynamic-import-split-require@1.x if you are using an older version.

npm travis standard

Install

npm install babel-plugin-dynamic-import-split-require

Usage

In .babelrc:

{
  "plugins": [
    "dynamic-import-split-require"
  ]
}

Input

import('whatever').then(onwhatever)

Output

var _import = require('split-require');
 
new Promise(function (resolve, reject) {
  _import("whatever", function (err, exports) {
    if (err) reject(err);else resolve(exports);
  });
}).then(onwhatever);

This code can be bundled by browserify using the split-require plugin.

License

Apache-2.0

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    48
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    48
  • 1.0.0
    1

Package Sidebar

Install

npm i babel-plugin-dynamic-import-split-require

Weekly Downloads

49

Version

2.0.0

License

Apache-2.0

Unpacked Size

4.98 kB

Total Files

7

Last publish

Collaborators

  • goto-bus-stop