Skip to content

Commit d2fe738

Browse files
authored
fix: ignore package.json file to prevent invalid code-path (#727)
The error in #674 is caused by a change of the package.json file during the build, which triggers some code path that is valid in WatchCompilerHostOfConfigFile but not in WatchCompilerHostOfFilesAndCompilerOptions that this plugin uses (because of configOverwrite option). This commit ignores the package.json file in watcher as a work-around. Closes: #674
1 parent fa772b4 commit d2fe738

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/watch/inclusive-node-watch-file-system.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import type { ForkTsCheckerWebpackPluginState } from '../plugin-state';
1212
import type { WatchFileSystem } from './watch-file-system';
1313

1414
const BUILTIN_IGNORED_DIRS = ['node_modules', '.git', '.yarn', '.pnp'];
15+
// we ignore package.json file because of https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/674
16+
const BUILTIN_IGNORED_FILES = ['package.json'];
1517

1618
function createIsIgnored(
1719
ignored: string | RegExp | (string | RegExp)[] | undefined,
@@ -35,6 +37,9 @@ function createIsIgnored(
3537
ignoredFunctions.push((path: string) =>
3638
BUILTIN_IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`))
3739
);
40+
ignoredFunctions.push((path: string) =>
41+
BUILTIN_IGNORED_FILES.some((ignoredFile) => path.endsWith(`/${ignoredFile}`))
42+
);
3843

3944
return function isIgnored(path: string) {
4045
return ignoredFunctions.some((ignoredFunction) => ignoredFunction(path));

0 commit comments

Comments
 (0)