Skip to content

Commit a064968

Browse files
authored
Merge pull request webpack#5297 from webpack/bugfix/watch-missing-directories
watch missing directories
2 parents 981fd23 + 329a805 commit a064968

8 files changed

Lines changed: 26 additions & 9 deletions

File tree

lib/node/NodeWatchFileSystem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class NodeWatchFileSystem {
4848
changes.filter(file => missing.indexOf(file) >= 0).sort(), times, times);
4949
});
5050

51-
this.watcher.watch(files.concat(missing), dirs, startTime);
51+
this.watcher.watch(files.concat(missing), dirs.concat(missing), startTime);
5252

5353
if(oldWatcher) {
5454
oldWatcher.close();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"supports-color": "^3.1.0",
2424
"tapable": "~0.2.5",
2525
"uglifyjs-webpack-plugin": "^0.4.6",
26-
"watchpack": "^1.3.1",
26+
"watchpack": "^1.4.0",
2727
"webpack-sources": "^1.0.1",
2828
"yargs": "^6.0.0"
2929
},

test/WatchTestCases.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ describe("WatchTestCases", () => {
129129
const jsonStats = stats.toJson({
130130
errorDetails: true
131131
});
132-
if(checkArrayExpectation(testDirectory, jsonStats, "error", "Error", done)) return;
133-
if(checkArrayExpectation(testDirectory, jsonStats, "warning", "Warning", done)) return;
132+
if(checkArrayExpectation(path.join(testDirectory, run.name), jsonStats, "error", "Error", done)) return;
133+
if(checkArrayExpectation(path.join(testDirectory, run.name), jsonStats, "warning", "Warning", done)) return;
134134
let exportedTests = 0;
135135

136136
function _it(title, fn) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = [
2+
[/Module not found/, /Can't resolve 'some-module' /]
3+
];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
it("should recover from missing module", function() {
2+
switch(WATCH_STEP) {
3+
case "0":
4+
(function() {
5+
require("some-module");
6+
}).should.throw();
7+
break;
8+
case "1":
9+
require("some-module").should.be.eql("ok");
10+
break;
11+
}
12+
});

test/watchCases/recover-from-error/missing-module/0/node_modules/module/index.js

Whitespace-only changes.

test/watchCases/recover-from-error/missing-module/1/node_modules/some-module/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

yarn.lock

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ character-parser@1.2.1:
508508
version "1.2.1"
509509
resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-1.2.1.tgz#c0dde4ab182713b919b970959a123ecc1a30fcd6"
510510

511-
chokidar@^1.4.3:
511+
chokidar@^1.7.0:
512512
version "1.7.0"
513513
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
514514
dependencies:
@@ -2088,6 +2088,7 @@ jade@^1.11.0:
20882088
jstransformer "0.0.2"
20892089
mkdirp "~0.5.0"
20902090
transformers "2.1.0"
2091+
uglify-js "^2.4.19"
20912092
void-elements "~2.0.1"
20922093
with "~4.0.0"
20932094

@@ -4184,12 +4185,12 @@ void-elements@~2.0.1:
41844185
version "2.0.1"
41854186
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
41864187

4187-
watchpack@^1.3.1:
4188-
version "1.3.1"
4189-
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.3.1.tgz#7d8693907b28ce6013e7f3610aa2a1acf07dad87"
4188+
watchpack@^1.4.0:
4189+
version "1.4.0"
4190+
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.4.0.tgz#4a1472bcbb952bd0a9bb4036801f954dfb39faac"
41904191
dependencies:
41914192
async "^2.1.2"
4192-
chokidar "^1.4.3"
4193+
chokidar "^1.7.0"
41934194
graceful-fs "^4.1.2"
41944195

41954196
webpack-dev-middleware@^1.9.0:

0 commit comments

Comments
 (0)