W3cubDocs

/Babel 6

Syntax Dynamic Import

Allow parsing of import()

Syntax only

This plugin only allows Babel to parse this syntax. If you want to transform it then see dynamic-import-webpack or dynamic-import-node.

Installation

npm install --save-dev babel-plugin-syntax-dynamic-import

Usage

.babelrc

{
  "plugins": ["syntax-dynamic-import"]
}

Via CLI

babel --plugins syntax-dynamic-import script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["syntax-dynamic-import"]
});

© 2018 Sebastian McKenzie
Licensed under the MIT License.
http://babeljs.io/docs/plugins/syntax-dynamic-import/