René's URL Explorer Experiment


Title: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles · Issue #33160 · angular/angular-cli · GitHub

Open Graph Title: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles · Issue #33160 · angular/angular-cli

X Title: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles · Issue #33160 · angular/angular-cli

Description: Issue: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles Command serve Is this a regression? Yes — this did not occur with the Webpack-based builder (@angular-devkit/build-angular:browser). ...

Open Graph Description: Issue: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles Command serve Is this a regression? Yes — this did not occur with the Webpack-based builder (...

X Description: Issue: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles Command serve Is this a regression? Yes — this did not occur with the Webpack-based builder (...

Opengraph URL: https://github.com/angular/angular-cli/issues/33160

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles","articleBody":"# Issue: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles\n\n## Command\n\n`serve`\n\n## Is this a regression?\n\nYes — this did not occur with the Webpack-based builder (`@angular-devkit/build-angular:browser`). It is specific to the `@angular-devkit/build-angular:application` builder (esbuild/Vite).\n\n## Description\n\nWhen running `ng serve` (or `nx serve` with the Angular dev-server), the application builds successfully, then **immediately** triggers \"Changes detected. Rebuilding...\" without any user file changes. This results in a full second rebuild on every serve startup, adding ~30–50 seconds of wasted time.\n\n### Root Cause\n\nThe issue is in `isInternalBundlerFile()` in `bundler-context.ts`. This function is responsible for filtering out non-real files from the watch file list. It currently handles `(disabled):` paths only when the suffix is a Node.js builtin module (e.g., `fs`, `path`, `util`):\n\n```typescript\n// Current code (v19.2.25):\nfunction isInternalBundlerFile(file: string): boolean {\n  // ...\n  const DISABLED_BUILTIN = '(disabled):';\n  const disabledIndex = file.indexOf(DISABLED_BUILTIN);\n  if (disabledIndex >= 0) {\n    return builtinModules.includes(file.slice(disabledIndex + DISABLED_BUILTIN.length));\n  }\n  return false;\n}\n```\n\nHowever, esbuild also generates `(disabled):` prefixed inputs for **browser-field disabled files** — i.e., when a third-party package has `\"browser\": { \"./some-file.js\": false }` in its `package.json`. In this case, esbuild records the input as:\n\n```\n(disabled):node_modules/object-inspect/util.inspect\n```\n\nSince `\"node_modules/object-inspect/util.inspect\"` is not in `builtinModules`, `isInternalBundlerFile()` returns `false`, and this non-existent path gets added to the watch file list.\n\nThe path is then joined with the workspace root to form:\n```\nP:\\Projects\\my-app\\(disabled):node_modules\\object-inspect\\util.inspect\n```\n\nWatchpack (the underlying file watcher) detects that this file does not exist and reports it as \"removed\", triggering an immediate rebuild.\n\n### Specific package triggering this\n\n[`object-inspect`](https://www.npmjs.com/package/object-inspect) (v1.13.4) — a transitive dependency commonly pulled in via `qs` → `side-channel` → `object-inspect`. Its `package.json` contains:\n\n```json\n{\n  \"browser\": {\n    \"./util.inspect.js\": false\n  }\n}\n```\n\nAnd `util.inspect.js` contains:\n```js\nmodule.exports = require('util').inspect;\n```\n\nThis is a legitimate pattern — the package disables the Node.js `util.inspect` wrapper in browser environments. But esbuild's metafile input entry `(disabled):node_modules/object-inspect/util.inspect` is not properly filtered by the Angular builder.\n\n### Suggested Fix\n\nChange `isInternalBundlerFile()` to treat **any** path containing `(disabled):` as internal, not just Node.js builtins:\n\n```typescript\nfunction isInternalBundlerFile(file: string): boolean {\n  if (file[0] === '\u003c' && file.at(-1) === '>') {\n    return true;\n  }\n  // Any (disabled): path is a virtual esbuild entry that doesn't exist on disk\n  if (file.includes('(disabled):')) {\n    return true;\n  }\n  return false;\n}\n```\n\nThis is safe because `(disabled):` is an esbuild-internal convention for files that have been stubbed out (whether builtins or browser-field disabled files). None of these paths exist on disk, so watching them is always incorrect.\n\n## Minimal Reproduction\n\n1. Create a new Angular 19 application using the `application` builder\n2. Install a package that depends on `object-inspect` (e.g., `npm install qs`)\n3. Import it somewhere in the app: `import qs from 'qs';`\n4. Run `ng serve`\n5. Observe:\n   - Build completes successfully\n   - \"Watch mode enabled. Watching for file changes...\" appears\n   - Immediately followed by \"Changes detected. Rebuilding...\" (with no user action)\n\nTo confirm the cause, add this line before the `for await` loop in `build-action.js`:\n```js\nrequire('node:fs').writeFileSync('watcher-debug.log', changes.toDebugString(), 'utf8');\n```\n\nThe log will show:\n```json\n{\n  \"added\": [],\n  \"modified\": [],\n  \"removed\": [\n    \"P:\\\\path\\\\to\\\\project\\\\(disabled):node_modules\\\\object-inspect\\\\util.inspect\"\n  ]\n}\n```\n\n## Your Environment\n\n```\nAngular CLI: 19.2.25\nNode: 20.12.2\nPackage Manager: npm 10.8.3\nOS: win32 x64\n\nAngular: 19.2.21\n\nPackage                          Version\n---------------------------------------------------------\n@angular-devkit/architect        0.1902.25\n@angular-devkit/build-angular    19.2.25\n@angular-devkit/core             19.2.25\n@angular/build                   19.2.25\n@angular/cli                     19.2.25\n```\n\n## Anything else relevant?\n\n- The issue likely affects **any** package using the `\"browser\": { \"./file.js\": false }` pattern in `package.json`. `object-inspect` is just one common example.\n- The problem is Windows-specific in terms of symptoms (watchpack on Windows uses `ReadDirectoryChangesW` which is more sensitive), but the underlying bug (adding non-existent paths to the watch list) exists cross-platform.\n- A previous related issue [#25197](https://github.com/angular/angular-cli/issues/25197) was fixed via [#26182](https://github.com/angular/angular-cli/pull/26182) (ignoring dot-directories). This is a different manifestation of the same class of problem.\n- The relevant source file is: `packages/angular/build/src/tools/esbuild/bundler-context.ts`, function `isInternalBundlerFile()`.\n","author":{"url":"https://github.com/fipil","@type":"Person","name":"fipil"},"datePublished":"2026-05-11T14:58:28Z","url":"https://github.com/angular/angular-cli/issues/33160"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5c197da3-0e7a-2875-c8c4-e3d16106fd30
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE844:928E2:1DCB070:27BA466:6B016F62
html-safe-noncea9061b953f379e002fe1dbe00acb1ddd971875679e648b08ae550713d84dfb33
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODQ0OjkyOEUyOjFEQ0IwNzA6MjdCQTQ2Njo2QjAxNkY2MiIsInZpc2l0b3JfaWQiOiI4NTExMzQ2MzY0NTQ0ODA2NzU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9331838841d210d54bdec8416396cc114c127b2e04276f66afcd6ce59f293c2d
hovercard-subject-tagissue:4421862192
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/33160/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d5210a1c1a1b1d06b491f2514f4ca4739e2f7e87c28dfe450372f79122dc078e/angular/angular-cli/issues/33160
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d5210a1c1a1b1d06b491f2514f4ca4739e2f7e87c28dfe450372f79122dc078e/angular/angular-cli/issues/33160
og:image:altIssue: Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFiles Command serve Is this a regression? Yes — this did not occur with the Webpack-based builder (...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefipil
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/33160#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F33160
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F33160
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://github.com/angular/angular-cli/issues/33160
Reloadhttps://github.com/angular/angular-cli/issues/33160
Reloadhttps://github.com/angular/angular-cli/issues/33160
angularhttps://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Codehttps://github.com/angular/angular-cli
Issues198 (198)https://github.com/angular/angular-cli/issues
Pull requests23 (23)https://github.com/angular/angular-cli/pulls
Actionshttps://github.com/angular/angular-cli/actions
Security and quality8 (8)https://github.com/angular/angular-cli/security
Insightshttps://github.com/angular/angular-cli/insights
https://github.com/angular/angular-cli
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/33160
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/33160
#33205https://github.com/angular/angular-cli/pull/33205
Dev server triggers spurious rebuild due to browser-field disabled files leaking into watchFileshttps://github.com/angular/angular-cli/issues/33160#top
#33205https://github.com/angular/angular-cli/pull/33205
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
https://github.com/fipil
fipilhttps://github.com/fipil
on May 11, 2026https://github.com/angular/angular-cli/issues/33160#issue-4421862192
object-inspecthttps://www.npmjs.com/package/object-inspect
#25197https://github.com/angular/angular-cli/issues/25197
#26182https://github.com/angular/angular-cli/pull/26182
angular-robothttps://github.com/apps/angular-robot
area: @angular-devkit/build-angularhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular-devkit%2Fbuild-angular%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
on May 11, 2026https://github.com/angular/angular-cli/issues/33160#event-25387783651
alan-agius4https://github.com/alan-agius4
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
area: @angular-devkit/build-angularhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular-devkit%2Fbuild-angular%22
on May 11, 2026https://github.com/angular/angular-cli/issues/33160#event-25395824365
clydinhttps://github.com/clydin
completedhttps://github.com/angular/angular-cli/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#33205https://github.com/angular/angular-cli/pull/33205
on May 14, 2026https://github.com/angular/angular-cli/issues/33160#event-25534549266
clydinhttps://github.com/clydin
on May 14, 2026https://github.com/angular/angular-cli/issues/33160#event-25534549342
fix(@angular/build): ignore virtual esbuild paths with (disabled):https://github.com/angular/angular-cli/commit/b06849a939948c92c139c218f34ea68d0ba28112
https://docs.github.com/articles/closing-issues-via-commit-messages
b06849ahttps://github.com/angular/angular-cli/commit/b06849a939948c92c139c218f34ea68d0ba28112
fix(@angular/build): ignore virtual esbuild paths with (disabled):https://github.com/angular/angular-cli/commit/cbad57579adb5de7887985afbb2bf1f40adf3cb2
https://docs.github.com/articles/closing-issues-via-commit-messages
cbad575https://github.com/angular/angular-cli/commit/cbad57579adb5de7887985afbb2bf1f40adf3cb2
fix(@angular/build): ignore virtual esbuild paths with (disabled):https://github.com/angular/angular-cli/commit/93d3527985f8aa1950f62ab42a88c0a74ae0b051
https://docs.github.com/articles/closing-issues-via-commit-messages
93d3527https://github.com/angular/angular-cli/commit/93d3527985f8aa1950f62ab42a88c0a74ae0b051
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jun 14, 2026https://github.com/angular/angular-cli/issues/33160#issuecomment-4700251051
automatic conversation locking policyhttps://github.com/angular/angular/blob/f0fbced1c55bc8b8ed9df01cea99df42f3e7eae3/contributing-docs/auto-issue-locking.md
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jun 14, 2026https://github.com/angular/angular-cli/issues/33160#event-26717599951
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/33160
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/33160
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.