Skip to content

Commit

Permalink
Watch mode should wait for file change. (T7411)
Browse files Browse the repository at this point in the history
  • Loading branch information
hayeah authored and panagosg7 committed Jan 17, 2017
1 parent e5decd6 commit f931fd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/babel-cli/src/babel/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ module.exports = function (commander, filenames) {
_.each(filenames, function (dirname) {
let watcher = chokidar.watch(dirname, {
persistent: true,
ignoreInitial: true
ignoreInitial: true,
awaitWriteFinish: {
stabilityThreshold: 50,
pollInterval: 10,
}
});

_.each(["add", "change"], function (type) {
Expand Down
6 changes: 5 additions & 1 deletion packages/babel-cli/src/babel/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ module.exports = function (commander, filenames, opts) {
let chokidar = util.requireChokidar();
chokidar.watch(filenames, {
persistent: true,
ignoreInitial: true
ignoreInitial: true,
awaitWriteFinish: {
stabilityThreshold: 50,
pollInterval: 10,
}
}).on("all", function (type, filename) {
if (util.shouldIgnore(filename) || !util.canCompile(filename, commander.extensions)) return;

Expand Down

0 comments on commit f931fd1

Please sign in to comment.