Home

Awesome

Named import

<p align="right"> <a href="https://www.npmjs.com/package/named-import"> <img alt="Npm version" src="https://badge.fury.io/js/named-import.svg"> </a> <a href="https://travis-ci.org/59naga/named-import"> <img alt="Build Status" src="https://travis-ci.org/59naga/named-import.svg?branch=master"> </a> </p>

a dynamic import sugar syntax function.

Installation

yarn add named-import

Usage

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

import namedImport from "named-import";
(async () => {
  var assert = (await import("assert")).default;
  // or
  var assert = await namedImport("assert");
})();

Also change the second argument to import another named.

import namedImport from "named-import";
(async () => {
  var strictEqual = (await import("assert")).strictEqual;
  // or
  var strictEqual = await namedImport("assert", "strictEqual");
})();

Incompatible Code Splitting

See also babel-plugin-experimental-syntax-dynamic-import.

License

MIT