npm.io
2.0.1 • Published 8 years ago

babel-plugin-dynamic-import-node-sync

Licence
MIT
Version
2.0.1
Deps
1
Vulns
0
Weekly
0
Stars
26

babel-plugin-dynamic-import-node-sync

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

I am using it for server-side rendering.

Difference from babel-plugin-dynamic-import-node

babel-plugin-dynamic-import-node-sync

import(SOURCE) => require(SOURCE)

babel-plugin-dynamic-import-node

import(SOURCE) => Promise.resolve().then(() => require(SOURCE))

Installation

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

Usage

.babelrc

{
  "plugins": ["dynamic-import-node-sync"]
}
Via CLI
$ babel --plugins dynamic-import-node-sync script.js

Keywords