【发布时间】:2016-05-16 15:48:34
【问题描述】:
所以我跟着安装here,但是babel编译需要很长时间,即使是小文件:
app.js
let app = 1;
.babelrc
{ "presets": ["es2015"] }
package.json
"scripts": {
"build": "babel app.js -o dist/app.js"
},
"devDependencies": {
"babel-cli": "^6.4.5",
"babel-preset-es2015": "^6.3.13"
}
然后npm run build 将需要大约 30 秒来编译。
我正在使用npm@3.3.12
【问题讨论】:
-
无法复制。不使用 NPM 直接运行命令会发生什么?
node_modules/.bin/babel app.js -o dist/app.js -
如果你在 npm 3 上你应该很好。也许清除你的 node_modules 并重新安装以确保?或者查看 node_modules 并确保您的依赖项都正确展平。
-
是的,来自我的安装,
rm -rf node_modules、npm cache clean和npm install成功了。
标签: npm ecmascript-6 babeljs