前端入门 - 安装 Babel
2017-08-19 21:34
288 查看
#Babel
Babel 是一个 JavaScript 编译器。用来编译 jsx ES15 ES6的语法进行转换。ES2015 and beyond
Babel has support for the latest version of JavaScript through syntax transformers. These plugins allow you to use new syntax, right now without waiting for browser support. Check out our env preset to get startedyou can install this preset with:
npm install --save-dev babel-preset-env
Polyfill
Since Babel only transforms syntax (like arrow functions), you can use babel-polyfill in order to support new globals such as Promise or new native methods like String.padStart (left-pad). It uses core-js and regenerator. Check out our babel-polyfill docs for more info.npm install --save-dev babel-polyfill
JSX and Flow
Babel can convert JSX syntax and strip out type annotations. Check out our React preset to get started. Use it together with the babel-sublime package to bring syntax highlighting to a whole new level.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 by project.There are two primary reasons for this.
Different projects on the same machine can depend on different versions of Babel allowing you to update one at a time.
It means you do not have an implicit dependency on the environment you are working in. Making your project far more portable and easier to setup.
We can install Babel CLI locally by running:
npm install --save-dev babel-cli
相关文章推荐
- 前端组件化Polymer入门教程(1)——初识&&安装
- 【我的Linux,我做主!】rpm包管理器/yum前端工具/编译安装从入门到精通
- Yeoman安装与入门 - 前端构建工具
- Babel 入门安装
- 前端PHP入门-002-安装WAMP的集成环境md
- 分布式Hadoop安装入门(5)——问题汇总
- git的安装与使用入门
- Python从入门到放弃(Mac) - Hello World(从安装到你的第一个程序)
- 用flex+BlazeDS做前端开发web入门小例
- 基于angularJS的前端自动化测试工具Protractor快速入门
- android学习——NDK入门 windows下安装cygwin 与 Eclipse使用CDT 自动编译
- jenkins入门手册----02第二章 Jenkins安装与配置
- Python爬虫入门 | 1 Python环境的安装
- [手机]游戏安装入门
- ngrok 安装入门
- python + pip 安装 & import 各种库-- 机器学习入门(1)
- ElasticSearch学习教程(一) 入门安装
- NFS安装使用快速入门
- Gradle入门(1):安装
- 【前端入门系列】HTML5动画与动效(之二)