跳到主要内容
CNode

在node中用 babel-cli 转译 es6时,怎样可以监测文件变化 就自动执行 package.json 中的 scripts 命令啊???

问答
Xxialexiatian发布于 10 年前最后回复 10 年前
647850

在node中用 babel-cli 转译 es6时,怎样可以监测文件变化 就自动执行 package.json 中的 scripts 命令啊??? 如何才能避免 不需要 每改动一次代码,就得 手动输入一次 npm run es6 命令来执行 转译啊??? babel.png

查看回复

回复 (6)

B
BoyInWindows#610 年前

官方文档 cli-babel To compile a file every time that you change it, use the --watch or -w option: babel script.js --watch --out-file script-compiled.js

E
einsqing#510 年前
引用 dlutwuweibabel node

@dlutwuwei 跑内存了,太卡,速度慢。

来自 KoaHubjs

C
CG-man#410 年前

gulp

R
richenlin#310 年前

package.json内添加scripts命令 "watch-compile": "babel src -d App -D --watch",

然后 npm run watch-compile

D
dlutwuwei#210 年前

babel-node

E
einsqing#110 年前

参考koahub-cli

来自 KoaHubjs

参与回复

登录后即可参与回复。登录