JSPM

  • Created
  • Published
  • Downloads 26355582
  • Score
    100M100P100Q250649F
  • License MIT

This plugin transforms ES2015 modules to AMD

Package Exports

  • @babel/plugin-transform-modules-amd

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-amd) 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-amd

This plugin transforms ES2015 modules to Asynchronous Module Definition (AMD).

Example

In

export default 42;

Out

define(["exports"], function (exports) {
  "use strict";

  Object.defineProperty(exports, "__esModule", {
    value: true
  });

  exports.default = 42;
});

Installation

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

Usage

.babelrc

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

Via CLI

babel --plugins @babel/transform-modules-amd script.js

Via Node API

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

Options

See options for babel-plugin-transform-commonjs.