babel-plugin-transform-dynamic-import-default

0.0.4 • Public • Published

Transform dynamic import default

Npm version Build Status

Add .default to dynamicImport using AwaitExpression.

Installation

yarn add babel-plugin-transform-dynamic-import-default

Usage

Real dynamic-import syntax will force the .default, but this plugin will omit it.

// index.js
(async () => {
  var assert = await import("assert");
})();
babel index.js --plugins=transform-dynamic-import-default

becomes:

(async () => {
  var assert = (await import("assert")).default;
})();

If you want to do multiple imports using destructuring objects, this plugin doesn't transform anything.

(async () => {
  var { strictEqual, deepEqual } = await import("assert");
})();

becomes(nothing happens):

(async () => {
  var { strictEqual, deepEqual } = await import("assert");
})();

See also

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.413latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.413
0.0.30

Package Sidebar

Install

npm i babel-plugin-transform-dynamic-import-default

Weekly Downloads

13

Version

0.0.4

License

MIT

Unpacked Size

62.7 kB

Total Files

7

Last publish

Collaborators

  • 59naga