Skip to content

Commit 481818c

Browse files
committed
Fix behavior on windows
1 parent 2943435 commit 481818c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
*.crt
44

55
.DS_Store
6-
node_modules
6+
node_modules
7+
.idea

utils/common.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ const awaitWriteFinish = (path, prev, cb) => {
2020
const fileWatch =
2121
process.platform !== 'linux'
2222
? (x, cb) =>
23-
fs.watch(x, { recursive: true }, (_, filename) => {
24-
const fileChanged = path.join(x, filename);
25-
awaitWriteFinish(fileChanged, {}, cb);
23+
fs.watch(x, {recursive: true}, (_, filename) => {
24+
if (filename !== null) { // filename can be null on windows
25+
const fileChanged = path.join(x, filename);
26+
awaitWriteFinish(fileChanged, {}, cb);
27+
} else {
28+
setTimeout(cb, 50);
29+
}
2630
})
2731
: (x, cb) => {
2832
if (fs.statSync(x).isDirectory()) {

0 commit comments

Comments
 (0)