Skip to content

Commit 2e164f5

Browse files
authored
fix(cli): pagesWatcher should ignore files based on relative path (#1689)
1 parent 7dc19c0 commit 2e164f5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/cli/src/commands/dev/watchPageFiles.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,20 @@ export const watchPageFiles = (app: App): FSWatcher[] => {
6060
const pagesWatcher = chokidar.watch('.', {
6161
cwd: sourceDir,
6262
ignored: (filepath, stats) => {
63+
const relative = path.relative(sourceDir, filepath)
64+
6365
// This is important so that folders like node_modules will be ignored immediately without traversing their children
64-
if (ignoreMatcher(filepath)) {
66+
if (ignoreMatcher(relative)) {
6567
return true
6668
}
6769

6870
// ignore internal temp and cache directories
69-
if (stats?.isDirectory()) {
70-
return filepath === tempDir || filepath === cacheDir
71+
if (filepath === tempDir || filepath === cacheDir) {
72+
return true
7173
}
7274

7375
// ignore non-matched files
74-
return (
75-
!!stats?.isFile() && !pageMatcher(path.relative(sourceDir, filepath))
76-
)
76+
return !!stats?.isFile() && !pageMatcher(relative)
7777
},
7878
ignoreInitial: true,
7979
})

0 commit comments

Comments
 (0)