Title: No subresource integrity validation for dynamically loaded chunks · Issue #30724 · angular/angular-cli · GitHub
Open Graph Title: No subresource integrity validation for dynamically loaded chunks · Issue #30724 · angular/angular-cli
X Title: No subresource integrity validation for dynamically loaded chunks · Issue #30724 · 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 Angular CLI < 17 with @angular-devkit/build-angular:browser builder Description When b...
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 Angular CLI < 17 with @angular-devkit/build-an...
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 Angular CLI < 17 with @angular-devkit/build...
Opengraph URL: https://github.com/angular/angular-cli/issues/30724
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"No subresource integrity validation for dynamically loaded chunks","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\nAngular CLI \u003c 17 with @angular-devkit/build-angular:browser builder\n\n### Description\n\nWhen building an Angular application with the `subresourceIntegrity` option enabled, dynamically loaded chunks are no longer validated with the integrity attribute in the generated code. This is a regression from previous behavior when using the legacy `@angular-devkit/build-angular:browser` builder.\n\nUsing the old `@angular-devkit/build-angular:browser` builder, after the application build, we had a `runtime.js` file where we could find the list of hashes for every chunk in the format `sriHashes = {chunkNumber1: \"sha384-hash1\", ...}`, and there was code that creates a script tag and adds the integrity attribute to it using the `sriHashes` list.\n\nExample of code from `runtime.js`\n```js\nvar f = document.createElement(\"script\");\nf.src = \"chunk.js\";\nf.integrity = sriHashes[chunkId];\nf.crossOrigin = \"anonymous\";\ndocument.head.appendChild(f);\n```\n\nSo the integrity validation worked for loaded chunks.\n\nIn the new `@angular-devkit/build-angular:application` builder, there is no list of hashes, and chunks are loaded just using `import(\"./chunk-name.js\")` code.\n\nA simple check by changing chunk code after build confirms it. There is no error from the browser about a wrong integrity value for the changed dynamically loaded chunk.\n\n### Minimal Reproduction\n\n- create new Angular (e.g. 19.2.15) application\n- add `subresourceIntegrity` flag in angular.json file\n```json\n{\n\"architect\": {\n \"build\": {\n \"builder\": \"@angular-devkit/build-angular:application\",\n \"configurations\": {\n \"production\": {\n \"subresourceIntegrity\": true,\n }\n }\n }\n }\n}\n```\n- add module with lazy loading\n- add link to open lazy loaded page\n- build application\n - `ng run build`\n- change code in dynamically loaded chunk in dist folder\n - e.g. add `console.log('test')` in any appropriate place in chunk code\n- run application from dist folder\n - e.g. use http-server\n- open application in browser\n- click link to load chunk\n- check if any error in console about invalid integrity\n\n### Exception or Error\n\n```text\n\n```\n\n### Your Environment\n\n```text\nAngular CLI: 19.2.15\nNode: 22.15.0\nPackage Manager: npm 10.9.2\nOS: darwin arm64\n\nAngular: 19.2.14\n... common, compiler, compiler-cli, core, forms, localize\n... platform-browser, platform-browser-dynamic, router\n\nPackage Version\n---------------------------------------------------------\n@angular-devkit/architect 0.1902.15\n@angular-devkit/build-angular 19.2.15\n@angular-devkit/core 19.2.15\n@angular-devkit/schematics 19.2.15\n@angular/cli 19.2.15\n@schematics/angular 19.2.15\nrxjs 7.8.2\ntypescript 5.7.3\nzone.js 0.15.1\n```\n\n### Anything else relevant?\n\n_No response_","author":{"url":"https://github.com/Henerator","@type":"Person","name":"Henerator"},"datePublished":"2025-07-16T19:47:58Z","url":"https://github.com/angular/angular-cli/issues/30724"}
| 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:74b09e31-ab92-4e3b-b9c6-4fc45edf865c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DB8:213839:381B300:47B3F34:6B01E852 |
| html-safe-nonce | c08e4cdbf795df7beabd3ab1cd45846de639834f5988d6d959d38b77c7487730 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REI4OjIxMzgzOTozODFCMzAwOjQ3QjNGMzQ6NkIwMUU4NTIiLCJ2aXNpdG9yX2lkIjoiNDcwNDM0MTQwOTgyODgyNTE3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dbc5ba888aa462c3f53faf0a01ee330ed88ef16eefcd0536ad477f05bd691336 |
| hovercard-subject-tag | issue:3237156710 |
| 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/30724/issue_layout |
| twitter:image | https://opengraph.githubassets.com/462ef49601fcf517a97688f383e833c7de34b4602c63c32d921837b31b51c8cd/angular/angular-cli/issues/30724 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/462ef49601fcf517a97688f383e833c7de34b4602c63c32d921837b31b51c8cd/angular/angular-cli/issues/30724 |
| 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 Angular CLI < 17 with @angular-devkit/build-an... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Henerator |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width