babel-plugin-transform-dynamic-import

Babel plugin to transpile import() to a deferred require(), for node

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-plugin-transform-dynamic-import
2.1.05 years ago6 years agoMinified + gzip package size for babel-plugin-transform-dynamic-import in KB

Readme

babel-plugin-transform-dynamic-import
Babel plugin to transpile import() to a deferred require(), for node. Matches the proposed spec.
NOTE: Babylon >= v6.12.0 is required to correct parse dynamic imports.

Installation

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

Usage

Via .babelrc (Recommended)

.babelrc
{
  "plugins": ["transform-dynamic-import"]
}

Via CLI

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

Via Node API

require('@babel/core').transform('code', {
  plugins: ['transform-dynamic-import']
});