1
|
# babel-preset-es2015
|
2
|
|
3
|
> Babel preset for all es2015 plugins.
|
4
|
|
5
|
## Install
|
6
|
|
7
|
```sh
|
8
|
npm install --save-dev babel-preset-es2015
|
9
|
```
|
10
|
|
11
|
## Usage
|
12
|
|
13
|
### Via `.babelrc` (Recommended)
|
14
|
|
15
|
**.babelrc**
|
16
|
|
17
|
```json
|
18
|
{
|
19
|
"presets": ["es2015"]
|
20
|
}
|
21
|
```
|
22
|
|
23
|
### Via CLI
|
24
|
|
25
|
```sh
|
26
|
babel script.js --presets es2015
|
27
|
```
|
28
|
|
29
|
### Via Node API
|
30
|
|
31
|
```javascript
|
32
|
require("babel-core").transform("code", {
|
33
|
presets: ["es2015"]
|
34
|
});
|
35
|
```
|
36
|
|
37
|
## Options
|
38
|
|
39
|
### `loose`
|
40
|
|
41
|
`boolean`, defaults to `false`.
|
42
|
|
43
|
Enable "loose" transformations for any plugins in this preset that allow them.
|
44
|
|
45
|
### `modules`
|
46
|
|
47
|
`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`.
|
48
|
|
49
|
Enable transformation of ES6 module syntax to another module type.
|
50
|
|
51
|
Setting this to `false` will not transform modules.
|
52
|
|
53
|
### `spec`
|
54
|
|
55
|
`boolean`, defaults to `false`.
|
56
|
|
57
|
Enable "spec" transformations for any plugins in this preset that allow them.
|