$ npm install
babel命令
$ npm run build
babel和gulp结合
$ npm run dev
babel -> 分拆
单独维护
npm instlal babel --save-dev
babel
- babel-core
- babel-cli
- babel-preset-x
- babel-plugin-x
- babel-polyfill
- .......
- babel
- babel-node
一系列的plugin插件组合 完成es2015
每一个插件只做一件事情
babel-plugin-transform-runtime
API -> code
依赖关系 babel-core 一起下载
- normal
- loose
define(['a'], function(){
})
define(function(require, module, exports){
})
var fs = require('fs')
module.exports = function(){
}
import React from 'react';
export default a;
兼容
Array.from -> API
报错了 浏览器
polyfill
require('babel-polyfill')
API
- plugin 扩展插件
- gulp-babel
- webpack
- browserify
- mocha/karma
- 代码解析
- 打包合并
- 压缩 混淆
- md5
上线