tahamajs/Other_Lessons / AP /TA_1 /AP-ECE-UT.github.io /node_modules /babel-plugin-dynamic-import-node
6.69 GB
45,738 files
Updated about 2 months ago
Name
Size
lib
.babelrc164 Bytes
xet
.eslintignore19 Bytes
xet
.eslintrc75 Bytes
xet
.travis.yml664 Bytes
xet
CHANGELOG.md2.8 kB
xet
LICENSE1.06 kB
xet
README.md1.11 kB
xet
package.json2.84 kB
xet
utils.js243 Bytes
xet
README.md

babel-plugin-dynamic-import-node

Babel plugin to transpile import() to a deferred require(), for node. Matches the proposed spec.

NOTE: Babylon >= v6.12.0 is required to correctly parse dynamic imports.

Installation

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

Usage

Via .babelrc (Recommended)

.babelrc

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

Options

  • noInterop - A boolean value, that if true will not interop the require calls. Useful to avoid using require('module').default on commonjs modules.
{
  "plugins": [
    ["dynamic-import-node", { "noInterop": true }]
  ]
}

Via CLI

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

Via Node API

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

Code Example

Promise.all([
  import('./lib/import1'),
  import('./lib/import2')
 ]).then(([
   Import1,
   Import2
  ]) => {
   console.log(Import1);
   /* CODE HERE*/
  });
Total size
6.69 GB
Files
45,738
Last updated
Sep 12
Pre-warmed CDN
US EU US EU

Contributors