簡體   English   中英

Watchify不發出更新事件

[英]Watchify doesn't emit update event

我正在嘗試使用bundle.js自動構建我的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文件中所做的更改。 因此,該任務以某種方式重新運行,但是具有緩存的依賴項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM