* Consider reexports for bindingKindLookup. * Update test cases according to reexports change * Fix order for assign reexports. * void 0 assignation to module keys only for loose mode. * Create buildReexportsFromMeta helper. * Update umd/amd fixtures. * Refactor reexports build. * Hoist template for reexports. * Use map as a second argument of Array.from. * Remove unnecessary export.
@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
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.