Repository navigation
fix(@angular/build): add integrity metadata for all initial chunks beyond the module preload limit - #34400
Conversation
…yond the module preload limit With subresource integrity enabled, the import map integrity entries skipped every file in the initial files set. Only the first 10 initial script chunks receive a `modulepreload` hint (and none do when `preloadInitial` is disabled or `externalPackages` is set), so the remaining initial chunks ended up without any integrity metadata. Skip only entry points, which are referenced by their own tag, and files that actually received a hint. All other initial chunks are now included in the import map integrity entries. Closes angular#34395
There was a problem hiding this comment.
Code Review
This pull request updates the subresource integrity (SRI) generation logic in index-html-generator.ts to ensure that entry points and module preload hints carry their own integrity attributes, while other initial chunks are covered by the import map. Additionally, a new test suite index-html-generator_spec.ts has been introduced to verify these changes under different scenarios, such as when chunks exceed the preload limit or when preloads are disabled. There are no review comments, and I have no feedback to provide.
alan-agius4
left a comment
There was a problem hiding this comment.
Please see inline comments.
Use TEST_TMPDIR for the temporary directory, reuse createOutputFile from the bundler files module, follow the 'should ...' naming convention and assert directly on the generated HTML.
|
Applied in 0e685f1: |
PR Checklist
PR Type
What is the current behavior?
Issue Number: #34395
With
subresourceIntegrity, the import map integrity entries skipped every initial file, assuming amodulepreloadhint carried its hash. Only the first 10 initial chunks get a hint (none whenpreloadInitialis off orexternalPackagesis set), so the remaining initial chunks had no integrity metadata at all.What is the new behavior?
The import map now skips only entry points and files that actually received a hint, so all other initial chunks are covered. New specs fail before the change and pass after it.
Does this PR introduce a breaking change?
Other information
Docs box left unticked: no docs change is needed. Only the new
index-html-generator_spec.tsspecs were run, not the full suite.