fix(@angular/build): default preloadInitial to false when serviceWorker is enabled - #34024
Open
alan-agius4 wants to merge 1 commit into
Open
fix(@angular/build): default preloadInitial to false when serviceWorker is enabled#34024alan-agius4 wants to merge 1 commit into
alan-agius4 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request changes the default behavior of preloadInitial to default to false when a service worker is enabled, and true otherwise. It also updates the JSON schema and adds tests to verify this behavior. The reviewer suggested simplifying the conditional logic for preloadInitial in options.ts using optional chaining and nullish coalescing to make it more idiomatic.
…er is enabled When a service worker is enabled, application assets are prefetched and served from Cache Storage. Emitting `<link rel="modulepreload">` hints for initial shared chunks causes Chromium to discard them with a "cross-world service worker resource mismatch" warning on repeat visits, as well as triggering redundant network fetches. This change sets the default of `preloadInitial` to `false` when the `serviceWorker` option is enabled, while still allowing developers to explicitly override it if desired. Fixes angular#34022
alan-agius4
force-pushed
the
fix-sw-modulepreload
branch
from
September 4, 2026 07:20
4907d0d to
8e4bb0e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a service worker is enabled, application assets are prefetched and served from Cache Storage by the service worker. Emitting
<link rel="modulepreload">hints for initial shared chunks causes Chromium to discard them with a "cross-world service worker resource mismatch" warning on repeat visits, as well as triggering redundant network fetches.This change sets the default of
preloadInitialtofalsewhen theserviceWorkeroption is enabled, while still allowing developers to explicitly override it if desired.Fixes #34022