Buckets:
tahamajs/Other_Lessons / AP /TA_1 /AP-ECE-UT.github.io /node_modules /babel-plugin-dynamic-import-node /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 usingrequire('module').defaulton 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*/
});
Xet Storage Details
- Size:
- 1.11 kB
- Xet hash:
- 8ecf2f00543ac8c4d44c3771a3c8e22b21d61eb11c3aa8fea308523bb6c66d3f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.