JSPM

babel-plugin-dynamic-import-node-sync

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1333
  • Score
    100M100P100Q120310F
  • License MIT

Babel 7 plugin to transpile import() to a require(), for node

Package Exports

  • babel-plugin-dynamic-import-node-sync

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-dynamic-import-node-sync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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