87a7a4e3356972e226c8c2497cb8bd954b4ba691177033ba24e9117d2aa4c7ec7a27d36625806d1c345107ee610bdafafbea80ea752d4aa9efe98ab7190215 900 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # babel-plugin-transform-es2015-modules-amd
  2. > This plugin transforms ES2015 modules to [Asynchronous Module Definition (AMD)](https://github.com/amdjs/amdjs-api).
  3. ## Example
  4. **In**
  5. ```javascript
  6. export default 42;
  7. ```
  8. **Out**
  9. ```javascript
  10. define(["exports"], function (exports) {
  11. "use strict";
  12. Object.defineProperty(exports, "__esModule", {
  13. value: true
  14. });
  15. exports.default = 42;
  16. });
  17. ```
  18. ## Installation
  19. ```sh
  20. npm install --save-dev babel-plugin-transform-es2015-modules-amd
  21. ```
  22. ## Usage
  23. ### Via `.babelrc` (Recommended)
  24. **.babelrc**
  25. ```json
  26. {
  27. "plugins": ["transform-es2015-modules-amd"]
  28. }
  29. ```
  30. ### Via CLI
  31. ```sh
  32. babel --plugins transform-es2015-modules-amd script.js
  33. ```
  34. ### Via Node API
  35. ```javascript
  36. require("babel-core").transform("code", {
  37. plugins: ["transform-es2015-modules-amd"]
  38. });
  39. ```
  40. ### Options
  41. See options for `babel-plugin-transform-es2015-commonjs`.