Package Exports
- babel-plugin-dynamic-import-split-require
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-dynamic-import-split-require) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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. Installbabel-plugin-dynamic-import-split-require@1.x
if you are using an older version.
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.