Skip to content

Babel plugin to transpile import() to a require(), for node. Best solution for SSR with react-router

License

Notifications You must be signed in to change notification settings

seeden/babel-plugin-dynamic-import-node-sync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Via .babelrc (Recommended)

.babelrc

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

Via CLI

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

About

Babel plugin to transpile import() to a require(), for node. Best solution for SSR with react-router

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%