/ stream.nieuweinstituut.nl / node_modules / babel-plugin-dynamic-import-node /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]lib/2 years ago -  
[TXT]CHANGELOG.md39 years ago2.7K 
[   ]LICENSE39 years ago1.0K 
[   ]utils.js39 years ago243  
[   ]package.json2 years ago3.9K3e510ca test new git [كارل مبارك]
[TXT]README.md39 years ago1.1Kd768d73 docs [كارل مبارك]
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

.babelrc

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

Options

{
  "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*/
  });
Apache/2.4.38 (Debian) Server at www.karls.computer Port 80