Projekt

Obecné

Profil

Stáhnout (900 Bajtů) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
# babel-plugin-transform-es2015-modules-amd
2
3
> This plugin transforms ES2015 modules to [Asynchronous Module Definition (AMD)](https://github.com/amdjs/amdjs-api).
4
5
## Example
6
7
**In**
8
9
```javascript
10
export default 42;
11
```
12
13
**Out**
14
15
```javascript
16
define(["exports"], function (exports) {
17
  "use strict";
18
19
  Object.defineProperty(exports, "__esModule", {
20
    value: true
21
  });
22
23
  exports.default = 42;
24
});
25
```
26
27
## Installation
28
29
```sh
30
npm install --save-dev babel-plugin-transform-es2015-modules-amd
31
```
32
33
## Usage
34
35
### Via `.babelrc` (Recommended)
36
37
**.babelrc**
38
39
```json
40
{
41
  "plugins": ["transform-es2015-modules-amd"]
42
}
43
```
44
45
### Via CLI
46
47
```sh
48
babel --plugins transform-es2015-modules-amd script.js
49
```
50
51
### Via Node API
52
53
```javascript
54
require("babel-core").transform("code", {
55
  plugins: ["transform-es2015-modules-amd"]
56
});
57
```
58
59
### Options
60
61
See options for `babel-plugin-transform-es2015-commonjs`.