Projekt

Obecné

Profil

Stáhnout (1013 Bajtů) Statistiky
| Větev: | Revize:
1
# babel-plugin-transform-es2015-modules-systemjs
2

    
3
> This plugin transforms ES2015 modules to [SystemJS](https://github.com/systemjs/systemjs).
4

    
5
## Example
6

    
7
**In**
8

    
9
```javascript
10
export default 42;
11
```
12

    
13
**Out**
14

    
15
```javascript
16
System.register([], function (_export, _context) {
17
  return {
18
    setters: [],
19
    execute: function () {
20
      _export("default", 42);
21
    }
22
  };
23
});
24
```
25

    
26
## Installation
27

    
28
```sh
29
npm install --save-dev babel-plugin-transform-es2015-modules-systemjs
30
```
31

    
32
## Usage
33

    
34
### Via `.babelrc` (Recommended)
35

    
36
**.babelrc**
37

    
38
Without options:
39

    
40
```json
41
{
42
  "plugins": ["transform-es2015-modules-systemjs"]
43
}
44
```
45

    
46
With options:
47

    
48
```json
49
{
50
  "plugins": [
51
    ["transform-es2015-modules-systemjs", {
52
      // outputs SystemJS.register(...)
53
      "systemGlobal": "SystemJS"
54
    }]
55
  ]
56
}
57
```
58

    
59
### Via CLI
60

    
61
```sh
62
babel --plugins transform-es2015-modules-systemjs script.js
63
```
64

    
65
### Via Node API
66

    
67
```javascript
68
require("babel-core").transform("code", {
69
  plugins: ["transform-es2015-modules-systemjs"]
70
});
71
```
(2-2/3)