都怪自己眼瞎,辣么绿的一块都木看仔细
结果就是很悲催,网上找了一通,不行。连 babel-polyfill 都试了,回头再看一遍,Sogo, So easy!
var babel = require(‘gulp-babel’)
gulp.src(“./ES7/Exponentiation/demo.js”)
.pipe(babel({presets: [“stage-1”]}))
.pipe(gulp.dest(“./ES7/Exponentiation/dist”));
但是但是,好不容易到了终点,居然有 bug: https://github.com/babel/babylon/issues/26
具体代码可见: https://github.com/Vanessa219/emulation/tree/master/ES7/Exponentiation
顺带贴一下 ECMAScript 每个阶段的说明
The TC39 categorises proposals into 4 stages:
- stage-0 - Strawman: just an idea, possible Babel plugin.
- stage-1 - Proposal: this is worth working on.
- stage-2 - Draft: initial spec.
- stage-3 - Candidate: complete spec and initial browser implementations.
- stage-4 - Finished: will be added to the next yearly release.
Also check out the current tc39 proposals and its process document.