Skip to content

Commit

Permalink
Use compiler.fileTimestamps cause watcher may be null
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-André Zinser committed Jul 17, 2017
1 parent c0e8477 commit 912be01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export interface WebpackCompiler {
isChild(): boolean;
context: string; // a guess
watchFileSystem: WebpackNodeWatchFileSystem;
fileTimestamps: {[key: string]: number};
}

export interface WebpackModule {
Expand Down
4 changes: 1 addition & 3 deletions src/watch-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ function makeWatchRun(
const lastTimes = {};
let startTime : number = null;
return (watching: interfaces.WebpackWatching, cb: () => void) => {
const watcher = watching.compiler.watchFileSystem.watcher ||
watching.compiler.watchFileSystem.wfs.watcher;
if (null === instance.modifiedFiles) {
instance.modifiedFiles = {};
}
startTime = startTime || watching.startTime;
const times = watcher.getTimes();
const times = watching.compiler.fileTimestamps;
Object.keys(times)
.filter(filePath =>
times[filePath] > (lastTimes[filePath] || startTime)
Expand Down

0 comments on commit 912be01

Please sign in to comment.