Repository navigation
fix(@schematics/angular): migrate serviceWorker: true to a config path in use-application-builder - #34564
Conversation
…ath in use-application-builder The browser builder accepts `serviceWorker: true` without `ngswConfigPath` and falls back to `<projectRoot>/ngsw-config.json`, but the application builder only accepts a path or `false`. The migration kept `true` when `ngswConfigPath` was not set in the same options object, so the first `ng build` after migrating failed schema validation. Replace `true` with the `ngswConfigPath` of the same options, then the one in the base options, then the browser builder default.
There was a problem hiding this comment.
Code Review
This pull request updates the migration to the application builder by resolving how the serviceWorker option is handled, replacing serviceWorker: true with the actual path to the configuration file. However, the current implementation contains an issue where the else block incorrectly overwrites options['serviceWorker'] with options['ngswConfigPath'] even when the service worker is disabled (i.e., false or undefined). This would mistakenly enable the service worker across all configurations, and it is recommended to remove the else block to ensure it remains disabled when intended.
…onfig path in use-application-builder
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The browser builder accepts
serviceWorker: truewithoutngswConfigPathand falls back to<projectRoot>/ngsw-config.json, but the application builder only accepts a path orfalse. The migration kepttruewhenngswConfigPathwas not set in the same options object, so the firstng buildafter migrating failed schema validation.Replace
truewith thengswConfigPathof the same options, then the one in the base options, then the browser builder default.