Skip to content

Commit 361e065

Browse files
clydintsteuwer-accesso
authored andcommitted
fix(@angular/build): ignore virtual esbuild paths with (disabled):
Virtual files generated by esbuild for disabled browser fields leak into the watch list, causing spurious rebuilds in watch mode. Previously, only paths where the suffix was a Node.js builtin module were ignored. Now, any path containing `(disabled):` is ignored as it represents a virtual file that doesn't exist on disk. Fixes #33160
1 parent 8a5dc19 commit 361e065

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

packages/angular/build/src/tools/esbuild/bundler-context.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ import {
1313
BuildResult,
1414
Message,
1515
Metafile,
16-
OutputFile,
1716
build,
1817
context,
1918
} from 'esbuild';
2019
import assert from 'node:assert';
21-
import { builtinModules } from 'node:module';
2220
import { basename, extname, join, relative } from 'node:path';
2321
import { SERVER_GENERATED_EXTERNALS } from '../../utils/server-rendering/manifest';
2422
import {
@@ -491,12 +489,9 @@ function isInternalBundlerFile(file: string) {
491489
return true;
492490
}
493491

494-
const DISABLED_BUILTIN = '(disabled):';
495-
496-
// Disabled node builtins such as "/some/path/(disabled):fs"
497-
const disabledIndex = file.indexOf(DISABLED_BUILTIN);
498-
if (disabledIndex >= 0) {
499-
return builtinModules.includes(file.slice(disabledIndex + DISABLED_BUILTIN.length));
492+
// Any (disabled): path is a virtual esbuild entry that doesn't exist on disk
493+
if (file.includes('(disabled):')) {
494+
return true;
500495
}
501496

502497
return false;

0 commit comments

Comments
 (0)