Add babelrc tip
This commit is contained in:
parent
7438864585
commit
0f5c52feb5
1 changed files with 18 additions and 0 deletions
18
src/dev/web/front/babel-preset-stage-2.md
Normal file
18
src/dev/web/front/babel-preset-stage-2.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Babel and babel-preset-stage-2
|
||||||
|
|
||||||
|
If you want use the "Spead Operator" eg `...` in javascript, you need `babel-preset-stage-2`.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
yarn add -D babel-preset-stage-2
|
||||||
|
```
|
||||||
|
|
||||||
|
Then enable it your babelrc :
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
["es2015", { "modules": false }],
|
||||||
|
["stage-2"]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in a new issue