René's URL Explorer Experiment


Title: serve: with NG_HMR_CSTYLES=1, component stylesheets not touched by the last change revert to first-build content after a rebuild · Issue #34248 · angular/angular-cli · GitHub

Open Graph Title: serve: with NG_HMR_CSTYLES=1, component stylesheets not touched by the last change revert to first-build content after a rebuild · Issue #34248 · angular/angular-cli

X Title: serve: with NG_HMR_CSTYLES=1, component stylesheets not touched by the last change revert to first-build content after a rebuild · Issue #34248 · angular/angular-cli

Description: Command serve Is this a regression? Unknown. I have only tested 22.2.1. Description With NG_HMR_CSTYLES=1 (link-based component style hot reloading), ng serve emits component stylesheets as external /.css?ngcomp=... links. After a ...

Open Graph Description: Command serve Is this a regression? Unknown. I have only tested 22.2.1. Description With NG_HMR_CSTYLES=1 (link-based component style hot reloading), ng serve emits component stylesheets as externa...

X Description: Command serve Is this a regression? Unknown. I have only tested 22.2.1. Description With NG_HMR_CSTYLES=1 (link-based component style hot reloading), ng serve emits component stylesheets as externa...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"serve: with NG_HMR_CSTYLES=1, component stylesheets not touched by the last change revert to first-build content after a rebuild","articleBody":"### Command\n\nserve\n\n### Is this a regression?\n\nUnknown. I have only tested 22.2.1.\n\n### Description\n\nWith `NG_HMR_CSTYLES=1` (link-based component style hot reloading), `ng serve` emits component stylesheets as external `/\u003chash>.css?ngcomp=...` links. After a rebuild, the dev server serves fresh content only for the stylesheet(s) affected by that change. Every other component stylesheet is served with its content from the first build, dropping earlier edits that are still saved on disk.\n\nEach check below is a fresh request for the page and its `?ngcomp` links, so a freshly loaded page receives the stale content too.\n\nWithout the flag, the same edit sequence (steps c1 to c5) produces no stale stylesheet.\n\nHypothesis (unverified, from reading the code, not from debugging): in `@angular/build/src/builders/application/execute-build.js`, on every rebuild with `externalRuntimeStyles` the code runs\n\n```js\n// TODO: Only attempt rebundling of invalidated styles once incremental build results are supported.\nif (rebuildState && options.externalRuntimeStyles) {\n    componentStyleBundler.invalidate(rebuildState.fileChanges.all);\n    const componentResults = await componentStyleBundler.bundleAllFiles(true, true);\n    bundlingIndividualResults.push(...componentResults);\n}\n```\n\nso only the invalidated sheets are re-bundled, and the sheets that are not invalidated seem to be served from their initial-build output rather than their last-built output. I have not confirmed which layer (bundler cache, result merging, or the dev server asset map) drops the later content.\n\nSide observation, no claim about impact: with the flag, the SSR HTML contains no inline `\u003cstyle>` tags for component styles (links only); without it, it contains one `\u003cstyle>` per component.\n\n### Minimal Reproduction\n\n```sh\npnpm dlx @angular/cli@22.2.1 new repro --ssr --style=scss --defaults --skip-git --package-manager=pnpm\ncd repro\nmkdir src/app/a src/app/b\n```\n\n`src/app/_p.scss`:\n\n```scss\n$color: red;\n```\n\n`src/app/a/a.ts` (and the same for `src/app/b/b.ts` with `b`/`BComponent`/`app-b`):\n\n```ts\nimport { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-a',\n  template: '\u003cp class=\"a\">a\u003c/p>',\n  styleUrl: './style.scss',\n})\nexport class AComponent {}\n```\n\n`src/app/a/style.scss` (and the same for `b` with `.b`/`BASELINE-b`):\n\n```scss\n@use '../p';\n.a { color: p.$color; }\n.BASELINE-a { order: 0; }\n```\n\n`src/app/app.html`:\n\n```html\n\u003capp-a />\n\u003capp-b />\n```\n\n`src/app/app.ts`: import `AComponent` and `BComponent` and add them to `imports`.\n\nServe with the flag:\n\n```sh\nNG_HMR_CSTYLES=1 pnpm exec ng serve --port 8094 --no-open\n```\n\nHelper that fetches the page, takes every `?ngcomp` link and prints which marker classes each sheet contains (`check.sh`):\n\n```sh\n#!/bin/zsh\nlabel=$1\nhtml=$(curl -s http://localhost:8094/)\necho \"--- $label\"\necho \"$html\" | grep -oE 'href=\"[^\"]*ngcomp[^\"]*\"' | sed -E 's/href=\"//; s/\"$//; s/&/\\&/g' | while read -r h; do\n  body=$(curl -s \"http://localhost:8094/$h\")\n  who=$(echo \"$body\" | grep -oE '^\\.(a|b) ' | head -1 | tr -d ' .')\n  markers=$(echo \"$body\" | grep -oE '(BASELINE|MARK)-[A-Za-z0-9-]+' | tr '\\n' ' ')\n  echo \"$h  sheet=${who:-empty(app)}  markers: $markers\"\ndone\n```\n\nEdit sequence (wait about 4 seconds after each edit for the rebuild, then run `./check.sh \u003clabel>`):\n\n```sh\n./check.sh baseline\nprintf '.MARK-P1 { order: 1; }\\n' >> src/app/_p.scss      # c1: edit partial\nprintf '.MARK-P2 { order: 2; }\\n' >> src/app/_p.scss      # c2: edit partial again\nprintf '.MARK-A1 { order: 1; }\\n' >> src/app/a/style.scss # c3: edit sheet A only\nprintf '.MARK-P3 { order: 3; }\\n' >> src/app/_p.scss      # c4: edit partial again\nprintf '.MARK-B1 { order: 1; }\\n' >> src/app/b/style.scss # c5: edit sheet B only\nprintf '.MARK-A2 { order: 2; }\\n' >> src/app/a/style.scss # c6: edit sheet A only\n```\n\nObserved with `NG_HMR_CSTYLES=1` (markers present in each served sheet; all edits are saved on disk):\n\n| step | sheet A (`a/style.scss`) | sheet B (`b/style.scss`) |\n| --- | --- | --- |\n| baseline | BASELINE-a | BASELINE-b |\n| c1 edit `_p.scss` | P1 BASELINE-a | P1 BASELINE-b |\n| c2 edit `_p.scss` | P1 P2 BASELINE-a | P1 P2 BASELINE-b |\n| c3 edit A only | P1 P2 BASELINE-a A1 | **BASELINE-b** (lost P1, P2) |\n| c4 edit `_p.scss` | P1 P2 P3 BASELINE-a A1 | P1 P2 P3 BASELINE-b |\n| c5 edit B only | **BASELINE-a** (lost P1 P2 P3 A1) | P1 P2 P3 BASELINE-b B1 |\n| c6 edit A only | P1 P2 P3 BASELINE-a A1 A2 | **BASELINE-b** (lost P1 P2 P3 B1) |\n\n(Marker names abbreviated: `P1` is `MARK-P1`, etc. At c5 and c6 the partial still contains P1, P2 and P3 on disk.)\n\nControl: steps c1 to c5 without `NG_HMR_CSTYLES` (component styles inlined in the SSR HTML, no `ngcomp` links). Every step shows all markers present in both sheets, e.g. after c3 sheet B has `MARK-P1 MARK-P2 BASELINE-b`, after c5 sheet A has `MARK-P1 MARK-P2 MARK-P3 BASELINE-a MARK-A1` and sheet B has `MARK-P1 MARK-P2 MARK-P3 BASELINE-b MARK-B1`.\n\nExpected: after each rebuild every served component stylesheet reflects the current content of its sources (the latest successful build), not only the stylesheets touched by the latest change.\n\nActual: untouched sheets revert to their first-build content until they are touched again.\n\n### Exception or Error\n\nNo error is reported by the dev server. Its log only says `Component stylesheet(s) changed.` and `Stylesheet update sent to client(s).`.\n\n### Your Environment\n\n```\nAngular CLI       : 22.2.1\nAngular           : 22.2.1\nNode.js           : 26.7.0\nPackage Manager   : pnpm 10.30.2\nOperating System  : darwin arm64\n\n@angular/build            : 22.2.1\n@angular/cli              : 22.2.1\n@angular/common           : 22.2.1\n@angular/compiler         : 22.2.1\n@angular/compiler-cli     : 22.2.1\n@angular/core             : 22.2.1\n@angular/platform-browser : 22.2.1\n@angular/platform-server  : 22.2.1\n@angular/router           : 22.2.1\n@angular/ssr              : 22.2.1\nrxjs                      : 7.8.2\ntypescript                : 6.0.3\n```\n\n### Anything else relevant?\n\nStylesheets were checked with `curl` against the dev server (a fresh request per step), not in a browser, so I have not observed the visual effect in a browser. macOS (Darwin 25.x, arm64).\n","author":{"url":"https://github.com/johnjspiteri","@type":"Person","name":"johnjspiteri"},"datePublished":"2026-10-03T12:36:06Z","url":"https://github.com/angular/angular-cli/issues/34248"}

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:2c740d8c-cc9b-9514-31ac-acca8199ecd2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id81F8:DB09F:32408F3:402E512:6B01DE70
html-safe-nonceb609610384983fb8d7c17cd0a7e93969079ea984e65d24bbb3027c43c3778722
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUY4OkRCMDlGOjMyNDA4RjM6NDAyRTUxMjo2QjAxREU3MCIsInZpc2l0b3JfaWQiOiI3NzM5Mzg3MTY2MzA4MDMyMTEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac21ac5d9aef8f520d4ae8f25197d1d70eaf19cc95c8def21ee3b17381ebb86fb0
hovercard-subject-tagissue:5689667348
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/34248/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1e538eca80ca51dde61d0e98136239e159c4e685fc7ce015919a98af40061bfa/angular/angular-cli/issues/34248
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1e538eca80ca51dde61d0e98136239e159c4e685fc7ce015919a98af40061bfa/angular/angular-cli/issues/34248
og:image:altCommand serve Is this a regression? Unknown. I have only tested 22.2.1. Description With NG_HMR_CSTYLES=1 (link-based component style hot reloading), ng serve emits component stylesheets as externa...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejohnjspiteri
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/34248#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34248
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%2F34248
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/34248
Reloadhttps://github.com/angular/angular-cli/issues/34248
Reloadhttps://github.com/angular/angular-cli/issues/34248
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/34248
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34248
serve: with NG_HMR_CSTYLES=1, component stylesheets not touched by the last change revert to first-build content after a rebuildhttps://github.com/angular/angular-cli/issues/34248#top
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
needsTriagehttps://github.com/angular/angular-cli/milestone/11
https://github.com/johnjspiteri
johnjspiterihttps://github.com/johnjspiteri
on Oct 3, 2026https://github.com/angular/angular-cli/issues/34248#issue-5689667348
angular-robothttps://github.com/apps/angular-robot
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
on Oct 3, 2026https://github.com/angular/angular-cli/issues/34248#event-32396770691
angular-robothttps://github.com/apps/angular-robot
needsTriagehttps://github.com/angular/angular-cli/milestone/11
on Oct 3, 2026https://github.com/angular/angular-cli/issues/34248#event-32396771387
https://github.com/nagahara-naoki
nagahara-naokihttps://github.com/nagahara-naoki
on Nov 8, 2026https://github.com/angular/angular-cli/issues/34248#issuecomment-6716716974
Open the reproduction in StackBlitzhttps://stackblitz.com/edit/ra9ywwze?file=src%2Fapp%2F_p.scss
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/34248
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34248
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
needsTriageNo due datehttps://github.com/angular/angular-cli/milestone/11
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.