René's URL Explorer Experiment


Title: Debug ID changes the bytes of an optimized chunk but not its file name, so cached files fail the SRI check · Issue #34574 · angular/angular-cli · GitHub

Open Graph Title: Debug ID changes the bytes of an optimized chunk but not its file name, so cached files fail the SRI check · Issue #34574 · angular/angular-cli

X Title: Debug ID changes the bytes of an optimized chunk but not its file name, so cached files fail the SRI check · Issue #34574 · angular/angular-cli

Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.0.x Description Since 22.1.0 (#33110), the application builder adds a //# debugId=<...

Open Graph Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.0.x Description Since 22.1.0 (#33110), the ...

X Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.0.x Description Since 22.1.0 (#33110), the ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Debug ID changes the bytes of an optimized chunk but not its file name, so cached files fail the SRI check","articleBody":"### Command\n\nbuild\n\n### Is this a regression?\n\n- [x] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n22.0.x\n\n### Description\n\nSince 22.1.0 (#33110), the application builder adds a `//# debugId=\u003cuuid>` line to each browser JS file when script source maps are enabled. The ID comes from the bytes of the source map.\n\nWhen the chunk optimizer runs (by default when the build has 3 or more lazy chunks), Rolldown gives the chunks their final file names. The `[hash]` in these names covers the code of the chunk only. It does not cover the source map. The debugId line is added after that.\n\nA change that keeps the JS code of a chunk the same but changes its source map (for example, a change to a TypeScript type or to a comment) gives this result for a chunk that does not import other chunks:\n\n1. The file name stays the same.\n2. The debugId changes, because the source map changed.\n3. The file bytes change, because the debugId line changed.\n4. The SRI hash in `index.html` changes to match the new bytes.\n\nIn one build, the HTML and the files match. Across two builds, the rule \"same hashed file name means same content\" is no longer true.\n\nHosting setups depend on this rule: they cache hashed files as immutable. Any cache can keep the file from the previous build: a CDN such as Cloudflare, the browser cache, or a proxy. That cache then serves the old bytes together with the new `index.html`. The integrity check fails, the browser blocks the file, and the modules in it do not load.\n\nBefore 22.1.0 there was no debugId line, so the bytes of a hashed file changed only when its name changed.\n\n**Expected behavior:** if the bytes of a hashed output file change, its file name changes too.\n\n### Minimal Reproduction\n\nRepository: https://github.com/virgiliojr/angular-debugid-sri-repro\n\nThe app is a plain `ng new` app (Angular CLI 22.2.2) with 3 lazy routes, so the chunk optimizer runs. `lazy-a` and `lazy-b` use `src/app/shared/label.ts`. This module has no imports, so it becomes its own chunk.\n\n1. Run `npm ci`.\n2. Run `npx ng build --source-map --subresource-integrity`.\n3. In `dist/repro/browser/`, find the chunk that contains `label:`. Write down its file name and its SHA-384.\n4. In `src/app/shared/label.ts`, add `extra?: number;` to the `LabelInput` interface. This is a type-only change: the JS output of `label.ts` stays the same.\n5. Run `npx ng build --source-map --subresource-integrity` again.\n6. Find the chunk that contains `label:` again.\n\n`bash compare-builds.sh` in the repository does steps 2 to 6 and prints the result below.\n\n**Actual result:**\n\n```text\nBuild 1\n  file name:          chunk-z-ytF2G0.js\n  sha384 of bytes:    sha384-Y7f5K4V0FTCrXc6JQ2tGE+VllRWg501EixeFEPMjNMboDgwfeRc9E6l8oHlqTbX5\n  debugId line:       //# debugId=105cedd6-2603-584f-8e8d-7801d6020b96\n  sha in index.html:  yes\nBuild 2\n  file name:          chunk-z-ytF2G0.js\n  sha384 of bytes:    sha384-bgCbCJmJexbhKCHeS4kpofe2lKBPWJ1f3JpK9668+/jD2mfiEYADUy5xD1Usr1dZ\n  debugId line:       //# debugId=9c547775-c029-5af8-ba7e-25c70949f1b6\n  sha in index.html:  yes\n\nDiff of the chunk between the two builds:\n2c2\n\u003c //# debugId=105cedd6-2603-584f-8e8d-7801d6020b96\n---\n> //# debugId=9c547775-c029-5af8-ba7e-25c70949f1b6\n```\n\nThe file name is the same, but the bytes and the SRI hash in `index.html` are different.\n\n**Expected result:** if the bytes are different, the file name is different too.\n\nTo see the failure in a browser, serve the output of build 2, but serve `chunk-z-ytF2G0.js` from build 1. This is what a cache does after a deployment.\n\n### Exception or Error\n\n```text\nFailed to find a valid digest in the 'integrity' attribute for resource 'https://\u003chost>/chunk-z-ytF2G0.js' with computed SHA-384 integrity '\u003chash>'. The resource has been blocked.\n```\n\n### Your Environment\n\n```text\nAngular CLI       : 22.2.5\nAngular           : 22.2.3\nNode.js           : 24.18.0\nPackage Manager   : npm 11.16.0\nOperating System  : darwin arm64\n\n┌───────────────────────────┬───────────────────┬───────────────────┐\n│ Package                   │ Installed Version │ Requested Version │\n├───────────────────────────┼───────────────────┼───────────────────┤\n│ @angular/build            │ 22.2.5            │ ^22.2.2           │\n│ @angular/cli              │ 22.2.5            │ ^22.2.2           │\n│ @angular/common           │ 22.2.3            │ ^22.2.0           │\n│ @angular/compiler         │ 22.2.3            │ ^22.2.0           │\n│ @angular/compiler-cli     │ 22.2.3            │ ^22.2.0           │\n│ @angular/core             │ 22.2.3            │ ^22.2.0           │\n│ @angular/forms            │ 22.2.3            │ ^22.2.0           │\n│ @angular/platform-browser │ 22.2.3            │ ^22.2.0           │\n│ @angular/router           │ 22.2.3            │ ^22.2.0           │\n│ rxjs                      │ 7.8.2             │ ~7.8.0            │\n│ typescript                │ 6.0.3             │ ~6.0.2            │\n└───────────────────────────┴───────────────────┴───────────────────┘\n```\n\n### Anything else relevant?\n\nThis does not depend on the browser. Any cache in front of the hashed files can cause it.\n\nThe defect needs the chunk optimizer. With `NG_BUILD_OPTIMIZE_CHUNKS=false`, the same type change gives a new esbuild file name for the chunk (for example `chunk-P54LQIKA.js` to `chunk-5HS55H7R.js`), so the name and the bytes change together.\n\nA chunk that imports other chunks usually gets a new name anyway, because the names of the chunks it imports change. A chunk without such imports keeps its name.\n\nRelated: #33108, #33110, #33572. The current `main` still has this behavior: `injectDebugIds` (called from `execute-post-bundle.ts` when `sourcemapOptions.scripts` is true) changes the file contents but does not change the file name. The Rolldown pass in `chunk-optimizer.ts` uses `chunkFileNames: '\u003cname>-[hash].js'`.","author":{"url":"https://github.com/virgiliojr","@type":"Person","name":"virgiliojr"},"datePublished":"2026-10-28T16:37:46Z","url":"https://github.com/angular/angular-cli/issues/34574"}

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:9b920311-3ff8-1fe4-204d-5ada63fc0144
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id90F4:269AD9:2F5E233:3F46437:6B01E019
html-safe-nonce91b680889278aea31aa82d0596a69d7457faecf362b4c068050c45e9b3c17e5d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MEY0OjI2OUFEOToyRjVFMjMzOjNGNDY0Mzc6NkIwMUUwMTkiLCJ2aXNpdG9yX2lkIjoiMjc1OTg2OTAwNzUwNjAzODgwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacae7f67d76e26cda8d63be32c515ca32147e2899f9c8e3da53b8d818c9d7ac8da
hovercard-subject-tagissue:6083268189
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/34574/issue_layout
twitter:imagehttps://opengraph.githubassets.com/eba32b5659191921c4e91d2f98961fcbc1551b3b0832bc00e1cb0e85bcb9f4d6/angular/angular-cli/issues/34574
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/eba32b5659191921c4e91d2f98961fcbc1551b3b0832bc00e1cb0e85bcb9f4d6/angular/angular-cli/issues/34574
og:image:altCommand build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.0.x Description Since 22.1.0 (#33110), the ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevirgiliojr
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/34574#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34574
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%2F34574
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/34574
Reloadhttps://github.com/angular/angular-cli/issues/34574
Reloadhttps://github.com/angular/angular-cli/issues/34574
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/34574
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34574
#34583https://github.com/angular/angular-cli/pull/34583
Debug ID changes the bytes of an optimized chunk but not its file name, so cached files fail the SRI checkhttps://github.com/angular/angular-cli/issues/34574#top
#34583https://github.com/angular/angular-cli/pull/34583
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/virgiliojr
virgiliojrhttps://github.com/virgiliojr
on Oct 28, 2026https://github.com/angular/angular-cli/issues/34574#issue-6083268189
#33110https://github.com/angular/angular-cli/pull/33110
https://github.com/virgiliojr/angular-debugid-sri-reprohttps://github.com/virgiliojr/angular-debugid-sri-repro
#33108https://github.com/angular/angular-cli/issues/33108
#33110https://github.com/angular/angular-cli/pull/33110
#33572https://github.com/angular/angular-cli/pull/33572
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 28, 2026https://github.com/angular/angular-cli/issues/34574#event-34497457062
angular-robothttps://github.com/apps/angular-robot
needsTriagehttps://github.com/angular/angular-cli/milestone/11
on Oct 28, 2026https://github.com/angular/angular-cli/issues/34574#event-34497459600
alan-agius4https://github.com/alan-agius4
completedhttps://github.com/angular/angular-cli/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#34583https://github.com/angular/angular-cli/pull/34583
on Oct 30, 2026https://github.com/angular/angular-cli/issues/34574#event-34672514888
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/34574
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34574
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.