JSPM

  • Created
  • Published
  • Downloads 25468619
  • Score
    100M100P100Q257945F
  • License MIT

This plugin transforms ES2015 modules to SystemJS

Package Exports

  • @babel/plugin-transform-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-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-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 @babel/plugin-syntax-dynamic-import plugin before this one.

Installation

npm install --save-dev @babel/plugin-transform-modules-systemjs

Usage

.babelrc

Without options:

{
  "plugins": ["@babel/plugin-transform-modules-systemjs"]
}

With options:

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

Via CLI

babel --plugins @babel/plugin-transform-modules-systemjs script.js

Via Node API

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