JSPM

interop-require

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6118
  • Score
    100M100P100Q117099F
  • License CC0-1.0

Require babel's ES6 modules from node.

Package Exports

  • interop-require

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 (interop-require) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

interop-require

Require babel's ES6 modules from node.

With the release of babel@6 the way generated modules work now does NOT set the module.exports property; instead it sets exports.default. Of course this basically breaks everything trying to require() it. So this tiny module is a replacement for require() for node-based runtimes that imports the default if an ES6 module is detected. A necessary evil it seems, given this behavior is not changing: https://github.com/babel/babel/issues/2212.