JSPM

  • Created
  • Published
  • Downloads 2651833
  • Score
    100M100P100Q222364F
  • License MIT

This plugin transforms ES2015 modules to SystemJS

Package Exports

  • babel-plugin-transform-es2015-modules-systemjs

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-transform-es2015-modules-systemjs) 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-transform-es2015-modules-systemjs

This plugin transforms ES2015 modules to SystemJS.

Example

In

export default 42;

Out

System.register([], function (_export, _context) {
  return {
    setters: [],
    execute: function () {
      _export("default", 42);
    }
  };
});

For dynamic import support (import('./lazy.js').then(m => ...)), enable the syntax-dynamic-import plugin before this one.

Installation

npm install --save-dev babel-plugin-transform-es2015-modules-systemjs

Usage

.babelrc

Without options:

{
  "plugins": ["transform-es2015-modules-systemjs"]
}

With options:

{
  "plugins": [
    ["transform-es2015-modules-systemjs", {
      // outputs SystemJS.register(...)
      "systemGlobal": "SystemJS"
    }]
  ]
}

Via CLI

babel --plugins transform-es2015-modules-systemjs script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-es2015-modules-systemjs"]
});