Skip to content

Commit b06849a

Browse files
committed
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 a848bf1 commit b06849a

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 {
@@ -472,12 +470,9 @@ function isInternalBundlerFile(file: string) {
472470
return true;
473471
}
474472

475-
const DISABLED_BUILTIN = '(disabled):';
476-
477-
// Disabled node builtins such as "/some/path/(disabled):fs"
478-
const disabledIndex = file.indexOf(DISABLED_BUILTIN);
479-
if (disabledIndex >= 0) {
480-
return builtinModules.includes(file.slice(disabledIndex + DISABLED_BUILTIN.length));
473+
// Any (disabled): path is a virtual esbuild entry that doesn't exist on disk
474+
if (file.includes('(disabled):')) {
475+
return true;
481476
}
482477

483478
return false;

0 commit comments

Comments
 (0)