Skip to content

Commit

Permalink
fix: ensure directories are watched, not files (#1260)
Browse files Browse the repository at this point in the history
Fixes #1259
  • Loading branch information
remy authored Feb 19, 2018
1 parent 70cfb7d commit 1cda8fa
Show file tree
Hide file tree
Showing 2 changed files with 318 additions and 169 deletions.
7 changes: 7 additions & 0 deletions lib/monitor/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var chokidar = require('chokidar');
var undefsafe = require('undefsafe');
var config = require('../config');
var path = require('path');
const fs = require('fs');
var utils = require('../utils');
var bus = utils.bus;
var match = require('./match');
Expand Down Expand Up @@ -48,6 +49,12 @@ function watch() {
ignored.push(dotFilePattern);
}

// if the directory is a file, it somehow causes
// windows to lose the filename upon change
if (fs.statSync(dir).isFile()) {
dir = path.dirname(dir);
}

var watchOptions = {
ignorePermissionErrors: true,
cwd: dir,
Expand Down
Loading

0 comments on commit 1cda8fa

Please sign in to comment.