Skip to content

Commit

Permalink
fix: TypeStrong#775 node_modules not ignored.
Browse files Browse the repository at this point in the history
  • Loading branch information
annitya authored Feb 27, 2023
1 parent 2183502 commit b09896f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/watch/inclusive-node-watch-file-system.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extname } from 'path';
import { extname, relative, isAbsolute } from 'path';

import type { FSWatcher } from 'chokidar';
import chokidar from 'chokidar';
Expand Down Expand Up @@ -30,7 +30,10 @@ function createIsIgnored(
}
});
ignoredFunctions.push((path: string) =>
excluded.some((excludedPath) => path.startsWith(excludedPath))
excluded.some((excludedPath) => {
const relativePart = relative(excludedPath, path);
return relativePart && !relativePart.startsWith('..') && !isAbsolute(relativePart);
})
);
ignoredFunctions.push((path: string) =>
BUILTIN_IGNORED_DIRS.some(
Expand Down

0 comments on commit b09896f

Please sign in to comment.