フロント入門-Babelの取り付け

1754 ワード

同前
BabelはJavaScriptコンパイラです.jsx ES 15 ES 6の構文をコンパイルして変換します.
ES 2015 and beyond
Babel has support for the latest version of JavaScript through sysntax tranformers.The plugins allow you to use new systox,right now without waiting for browser support.Check out env prest started
you can install this prest with:
npm install --save-dev babel-preset-env
Polyfill
Since Babel onlyfill in order to support new globals Promise or new native methods like String.padStart.It-PadStart
npm install --save-dev babel-polyfill
JSX and Flow
Babel can convert JSX syntax and strip out type annotations.Check out our React prest to get started.Use it togethe r with the babel-sublime package to bring sntax highlighting to a wholevel.
npm install --save-dev babel-preset-react
Babel CLI
While you can install Babel CLI globally on your machine,it’s much better to install it locally project.
The re are two primary reasons for this.
ディfferent projects on the same machine can depend on different versions of Babel allowing to udate one at.It means you do have implicit dependency on the environment are ar.Making project faject
npm install --save-dev babel-cli