Title: augmentChunkHash hashes only input source maps, so an output-map change keeps a lazy chunk name while its debugId (and bytes) change · Issue #34774 · angular/angular-cli · GitHub
Open Graph Title: augmentChunkHash hashes only input source maps, so an output-map change keeps a lazy chunk name while its debugId (and bytes) change · Issue #34774 · angular/angular-cli
X Title: augmentChunkHash hashes only input source maps, so an output-map change keeps a lazy chunk name while its debugId (and bytes) change · Issue #34774 · 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 The same gap exists since #34583, but it shows up on a toolchain update: 22.2.6 → 22.3...
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 The same gap exists since #34583, but it shows...
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 The same gap exists since #34583, but it shows...
Opengraph URL: https://github.com/angular/angular-cli/issues/34774
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"augmentChunkHash hashes only input source maps, so an output-map change keeps a lazy chunk name while its debugId (and bytes) change","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\nThe same gap exists since #34583, but it shows up on a toolchain update: 22.2.6 → 22.3.0.\n\n### Description\n\n#34583 made the chunk optimizer's `augmentChunkHash` include the hashes of the *input* source maps of a chunk's modules, so that a change that only affects the source map renames the chunk (#34574). The `//# debugId=` comment injected after naming is derived from the *output* source map, though, and the output map can change while every input map stays the same.\n\nUpdating `@angular/build` from 22.2.6 to 22.3.0 does exactly that for vendor-only lazy chunks. In our production build, two lazy chunks that hold only third-party code (SheetJS and jsPDF, loaded with `import()`) kept their file names, and their JavaScript was byte-for-byte identical apart from the trailing comment:\n\n```\n-//# debugId=e8aee844-1ba7-543c-be31-811b9fc51bb2\n+//# debugId=fb140939-ab0f-576a-a399-540d2ee6737b\n```\n\nIn the chunks' `.map` files, `sources` and `sourcesContent` are identical; only `names` and `mappings` differ (the newer minifier maps the same output differently). The input maps are unchanged, so `augmentChunkHash` returns the same value, Rolldown's code hash is the same, and the file name is the same while the bytes differ.\n\nWith `subresourceIntegrity` on, a browser or CDN that holds the old copy under that name fails the integrity check against the new `index.html`, and the lazy import fails. The same applies to any update that changes only how the output is mapped (minifier, Rolldown, or the debug ID computation), so every toolchain bump can reintroduce it.\n\nRelated: #34674 reports the same symptom for `main` and `polyfills`, and proposes naming files from their final bytes after debug IDs are injected. That approach would also cover this case; hashing the output map (or the final file contents) in `augmentChunkHash` would cover it for optimized lazy chunks.\n\n### Minimal Reproduction\n\n1. An application with source maps on for scripts, `subresourceIntegrity: true`, and enough lazy chunks for the chunk optimizer to run (3 or more), including at least one lazy chunk that holds only a third-party library loaded with `import('\u003cpackage>')`.\n2. Build with `@angular/build` 22.2.6 and keep `dist/`.\n3. Update `@angular/build` and `@angular/cli` to 22.3.0 without changing application code, and build again.\n4. Compare the two `dist/` folders: list files that exist in both with the same name and different contents. The vendor-only lazy chunk is among them, and `diff` shows only the `//# debugId=` line changed.\n\n### Exception or Error\n\n```text\nFailed to find a valid digest in the 'integrity' attribute for resource '\u003corigin>/chunk-XXXXXXXX.js' with computed SHA-384 integrity '...'. The resource has been blocked.\n```\n\n### Your Environment\n\n```text\nAngular CLI : 22.3.0\n@angular/build : 22.3.0 (previous build: 22.2.6)\n@angular/core : 22.3.0\nTypeScript : 6.0.3\nNode.js : 24.22.1\nPackage manager : npm 11.19\nOS : macOS and Linux (CI)\n\nBuild options: `sourceMap: true`, `subresourceIntegrity: true`, `outputHashing: all`, production configuration.\n\nBuild options: sourceMap: true, subresourceIntegrity: true, outputHashing: all, production configuration.\n```\n\n### Anything else relevant?\n\n(The error above is the shape of the browser error when a stale cached copy is served; our CI caught the name collision before deploy, so we did not ship it.)\n\nWorkaround we used: change what the app imports from each library (a local module that re-exports only the used members), which changes the rendered chunk code and so its name. `namedChunks: true` only changes the readable prefix; the `[hash]` part is computed the same way, so it does not prevent this.","author":{"url":"https://github.com/ddehaangfs","@type":"Person","name":"ddehaangfs"},"datePublished":"2026-11-22T14:19:19Z","url":"https://github.com/angular/angular-cli/issues/34774"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e76776b4-629d-e0f1-b507-fa89f98c99dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C44A:C802B:32F989:44D260:6B061A2A |
| html-safe-nonce | 15cfbffef3c89ccadf6393f3e92170451d531de6892e02472b215b3c3b4c0a1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDRBOkM4MDJCOjMyRjk4OTo0NEQyNjA6NkIwNjFBMkEiLCJ2aXNpdG9yX2lkIjoiNjMwMzMxMTc1MjIxMDAyOTA5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 03b969c7c4030b38dab8a6b76da18279fadec594b4b87b5ae78c1f1b8e8499e0 |
| hovercard-subject-tag | issue:6543455006 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/34774/issue_layout |
| twitter:image | https://opengraph.githubassets.com/94f78f1179762d0016cf6fcec304c18f7b7669fddede04c4b42e5da1c589b303/angular/angular-cli/issues/34774 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/94f78f1179762d0016cf6fcec304c18f7b7669fddede04c4b42e5da1c589b303/angular/angular-cli/issues/34774 |
| og:image:alt | 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 The same gap exists since #34583, but it shows... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ddehaangfs |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width