@@ -42,9 +42,9 @@ class InclusiveNodeWatchFileSystem implements WatchFileSystem {
42
42
this . removedFiles . clear ( ) ;
43
43
44
44
// use standard watch file system for files and missing
45
- const fileWatcher = this . watchFileSystem . watch (
45
+ const standardWatcher = this . watchFileSystem . watch (
46
46
files ,
47
- [ ] ,
47
+ dirs ,
48
48
missing ,
49
49
startTime ,
50
50
options ,
@@ -53,21 +53,21 @@ class InclusiveNodeWatchFileSystem implements WatchFileSystem {
53
53
) ;
54
54
55
55
this . watcher ?. on ( 'change' , ( file : string ) => {
56
- if ( ! isIgnored ( file ) ) {
56
+ if ( typeof file === 'string' && ! isIgnored ( file ) ) {
57
57
this . changedFiles . add ( file ) ;
58
58
this . removedFiles . delete ( file ) ;
59
59
}
60
60
} ) ;
61
61
this . watcher ?. on ( 'remove' , ( file : string ) => {
62
- if ( ! isIgnored ( file ) ) {
62
+ if ( typeof file === 'string' && ! isIgnored ( file ) ) {
63
63
this . removedFiles . add ( file ) ;
64
64
this . changedFiles . delete ( file ) ;
65
65
}
66
66
} ) ;
67
67
68
68
// calculate what to change
69
69
const prevDirs = Array . from ( this . dirsWatchers . keys ( ) ) ;
70
- const nextDirs = Array . from ( dirs ) ;
70
+ const nextDirs = Array . from ( this . pluginState . lastDependencies ?. dirs || [ ] ) ;
71
71
const dirsToUnwatch = prevDirs . filter ( ( prevDir ) => ! nextDirs . includes ( prevDir ) ) ;
72
72
const dirsToWatch = nextDirs . filter (
73
73
( nextDir ) => ! prevDirs . includes ( nextDir ) && ! isIgnored ( nextDir )
@@ -135,13 +135,13 @@ class InclusiveNodeWatchFileSystem implements WatchFileSystem {
135
135
this . paused = false ;
136
136
137
137
return {
138
- ...fileWatcher ,
138
+ ...standardWatcher ,
139
139
close : ( ) => {
140
140
this . changedFiles . clear ( ) ;
141
141
this . removedFiles . clear ( ) ;
142
142
143
- if ( fileWatcher ) {
144
- fileWatcher . close ( ) ;
143
+ if ( standardWatcher ) {
144
+ standardWatcher . close ( ) ;
145
145
}
146
146
this . dirsWatchers . forEach ( ( dirWatcher ) => {
147
147
dirWatcher ?. close ( ) ;
@@ -151,8 +151,8 @@ class InclusiveNodeWatchFileSystem implements WatchFileSystem {
151
151
this . paused = true ;
152
152
} ,
153
153
pause : ( ) => {
154
- if ( fileWatcher ) {
155
- fileWatcher . pause ( ) ;
154
+ if ( standardWatcher ) {
155
+ standardWatcher . pause ( ) ;
156
156
}
157
157
this . paused = true ;
158
158
} ,
0 commit comments