@babel/plugin-transform-modules-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
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["@babel/plugin-transform-modules-amd"]
}
Via CLI
babel --plugins @babel/plugin-transform-modules-amd script.js
Via Node API
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-modules-amd"]
});
Options
See options for @babel/plugin-transform-modules-commonjs
.