gpt4 book ai didi

javascript - Watchify 不发出更新事件

转载 作者:行者123 更新时间:2023-11-30 06:53:03 26 4
gpt4 key购买 nike

我正在尝试使用 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 时,行为是相似的:构建在启动后运行一次,仅此而已。

watchify ./js/main.js -o js-dist/bundle.js -v

我正在使用 OS X Yosemite。

最佳答案

我也遇到了同样的问题。我使用了 gulp repro 中的食谱。第一个 bundlejs 任务按预期工作。但是,当我更改为依赖项之一时,什么也没有发生。

似乎没有运行更新功能。但是,在 main.js 文件中所做的更改会重新编译。因此,任务以某种方式重新运行,但具有缓存的依赖项。

关于javascript - Watchify 不发出更新事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29222702/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com