import 'babel-polyfill'; function g(func) { console.log(func(1)); } g(item => item + 1); let obj = { "0" : 1, length: 1 }; let str = 'ha'; console.log(str.repeat(3)); let a = Array.from(obj); console.log(a);
在已经安装了babel-polyfill的情况下
{
"name": "sadtommy",
"version": "1.0.0",
"description": "sad tommy",
"main": "index.js",
"dependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1"
},
"devDependencies": {
"babel-cli": "^6.0.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-register": "^6.24.1"
},
"scripts": {
"build": "babel babel/source -d babel/target"
},
"repository": {
"type": "git",
"url": "git+https://github.com/CallMeTommy1988/qianduanxuexi.git"
},
"author": "tommy",
"license": "ISC",
"bugs": {
"url": "https://github.com/CallMeTommy1988/qianduanxuexi/issues"
},
"homepage": "https://github.com/CallMeTommy1988/qianduanxuexi#readme"
}
并不转码,这让我很困惑,那里出问题了?
谁告诉你babel 是这样用的?去查官方文档吧。