我正在尝试使用watchify自动构建我的bundle.js,但不幸的是,当我保存文件时没有触发任何更新事件。
var bundler = watchify(browserify({
debug: true,
entries: ['./js/main.js'],
transform: "babelify",
cache: {}, packageCache: {}, fullPaths: true
}))
.on("update", function () {
var updateStart = Date.now();
console.log(updateStart);
return bundler
.bundle()
.pipe(exorcist(path.join(distPath, "bundle.js.map")))
.pipe(fs.createWriteStream(path.join(distPath, "bundle.js")));
})
.bundle()
.pipe(exorcist(path.join(distPath, "bundle.js.map")))
.pipe(fs.createWriteStream(path.join(distPath, "bundle.js")));当我使用CLI时,行为是相似的: Build在启动后运行一次,仅此而已。
watchify ./js/main.js -o js-dist/bundle.js -v我使用的是OS X Yosemite。
发布于 2015-04-09 05:03:30
我也有同样的问题。我用了大口的复制品上的食谱。第一个bundlejs任务按预期工作。但是,当我对其中一个依赖项进行更改时,不会发生任何事情。
看起来更新函数没有运行。但是,将重新编译在main.js文件中所做的更改。因此,任务以某种方式重新运行,但带有缓存的依赖项。
https://stackoverflow.com/questions/29222702
复制相似问题