@babel/plugin-transform-modules-amd

Example

In

  1. export default 42;

Out

  1. define(["exports"], function (exports) {
  2. "use strict";
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = 42;
  7. });

Installation

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

Usage

.babelrc

  1. {
  2. "plugins": ["@babel/plugin-transform-modules-amd"]
  3. }

Via CLI

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

Via Node API

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

Options

See options for @babel/plugin-transform-modules-commonjs.