babel-plugin-dynamic-import-split-require
babel plugin to compile `import()` syntax to `split-require`, the commonjs bundle splitting library
Last updated 3 years ago by goto-bus-stop .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-dynamic-import-split-require 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.0                                ...           latest (3 years ago)

2 Versions

  • 2.0.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 3
Dependencies (1)
Dev Dependencies (4)

Copyright 2014 - 2017 © taobao.org |