.babelrc
{
"presets": [
"es2015",
"stage-0"
]
}
index.js
import "babel-polyfill";
function addAll() {
return Array.from(arguments).reduce(function (a, b) {
return a + b;
});
}
运行编译
babel index.js -o dist.js
编译出来的dist.js
"use strict";
require("babel-polyfill");
function addAll() {
return Array.from(arguments).reduce(function (a, b) {
return a + b;
});
}
并没有把Array.from转成es5语法啊?
Node运行版本是8.9.3
万千封印
相关分类