Skip to content

Conversation

@josephperrott
Copy link
Member

Previously when determining the configPath for building the service worker, the config path
was loaded as a relative path to location where execution of ng build occured. Instead the
ngswConfig value provided in angular.json should be considered relative to th application
root, as is the case with the other paths provided in the configuration.

Before this change, assuming a project root of /project, and a ngswConfig value of ngsw-config.json,
the application built successfully when the exuction working directory was /project, but if the
user invoked ng build from /project/src for instance, the build failed as ngsw-config.json does not
exist at /project/src/ngsw-config.json.

@josephperrott josephperrott added area: @angular-devkit/build-angular target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Feb 22, 2022
@josephperrott josephperrott requested a review from clydin February 22, 2022 19:20
…e application root

Previously when determining the `configPath` for building the service worker, the config path
was loaded as a relative path to location where  execution of ng build occured.  Instead the
`ngswConfig` value provided in `angular.json` should be considered relative to th application
root, as is the case with the other paths provided in the configuration.

Before this change, assuming a project root of `/project`, and a `ngswConfig` value of `ngsw-config.json`,
the application built successfully when the exuction working directory was `/project`, but if the
user invoked ng build from `/project/src` for instance, the build failed as `ngsw-config.json` does not
exist at `/project/src/ngsw-config.json`.
@josephperrott josephperrott force-pushed the fix-service-worker-config-path branch from 5024995 to 5f71e54 Compare February 22, 2022 19:20
@clydin
Copy link
Member

clydin commented Feb 24, 2022

Good catch on this one.
Unfortunately, the change will probably need to be a little more complicated since all the paths in the angular.json file should be relative to the location of the angular.json file (that location is also the workspace root). The default value for ngswConfig is ${appRoot}/ngsw-config.json with that value then being relative to the workspace root (assuming the appRoot value has not already been resolved with the workspace root).

@clydin
Copy link
Member

clydin commented Apr 27, 2022

Superseded by #23045

@clydin clydin closed this Apr 27, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 28, 2022
@josephperrott josephperrott deleted the fix-service-worker-config-path branch February 20, 2025 16:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: @angular-devkit/build-angular target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants