feat(ngsw): per-locale ngsw.json when --localize is set (#148) - #182
Merged
lukekania merged 1 commit intoMay 22, 2026
Merged
Conversation
Previously a localized build with serviceWorker enabled skipped ngsw.json generation entirely, forcing apps to choose between i18n and PWA caching. Move the service-worker step to run after locale fan-out and, when --localize is in use, emit one ngsw.json per <out_dir>/<locale>/ deploy root. Asset hashes are computed from each locale's own tree, so a translated bundle hashes differently per locale — correct cache invalidation. The non-localized path is unchanged. Bump version to 0.10.14.
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.
Summary
Closes #148.
A localized build (
--localize) withserviceWorker: truepreviously skippedngsw.jsongeneration entirely, with the warning "per-locale manifests are not yet supported". Apps had to choose between i18n and PWA caching.This change:
fan_out_locales).--localizeis set, emits onengsw.jsonper<out_dir>/<locale>/subdirectory — each locale subdir is its own PWA deploy root, matching@angular/service-worker's expectation of one manifest per deploy root./<locale>/prefix).No
ngsw.rschanges were needed:generate_manifestalready walks adist_dirand emits root-relative URLs, so it works correctly when handed a locale subdir.Bumps version to 0.10.14.
Test plan
cargo test -p ngc-rs test_service_worker_pipeline— newtest_service_worker_pipeline_localized_fixtureplus the existing non-localized fixture passcargo test -p ngc-rs— full crate suite greencargo clippy -p ngc-rs --bins --tests— no warningsngsw.jsonexists, URLs are deploy-root-relative, hashes match each locale's own bytes, anden/frrecord different hashes for the translated bundle