Skip to content

Provide extension points in order to add custom behavior to the service worker file generated by the angular cli. #21197

Closed as not planned

Description

@balteo

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

As of now, I can either register the angular-generated service worker (i.e. /ngsw-worker.js) or register my own custom service worker (see documentation: https://angular.io/api/service-worker/ServiceWorkerModule#static-members)

Expected behavior

One should be able to add custom behavior to angular-generated service workers (i.e. /ngsw-worker.js). For instance what if I want to add business logic to the service worker. It would be nice to provide extension points in order to achieve this and document them.

EDIT (gkalpak): Other related issues/issues that could be fixed by this: #24387, #26413, #30195, #46984

Activity

  1. changed the title [-]Provide extension points in order to add custom behavior to service worker file generated by the angular cli.[/-] [+]Provide extension points in order to add custom behavior to the service worker file generated by the angular cli.[/+] on Dec 28, 2017
  2. added
    area: service-workerIssues related to the @angular/service-worker package
    featureLabel used to distinguish feature request from other issues
    on Jan 2, 2018
  3. added this to the Backlog milestone on Jan 23, 2018
  4. angular-robot commented on Jun 5, 2021

    @angular-robot
    Contributor

    Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

    Find more details about Angular's feature request process in our documentation.

  5. angular-robot commented on Jun 26, 2021

    @angular-robot
    Contributor

    Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

    We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

    You can find more details about the feature request process in our documentation.

  6. self-assigned this
    on Sep 17, 2021
  7. yelhouti commented on Dec 20, 2022

    @yelhouti
    Contributor

    @jessicajaniuk thanks for marking this as under consideration, I would like to work on this to move it forward, I was thinking about integrating it with workbox, to avoid redundant work, there mechanism of registerRoute seems very well suited for this use case. And their code could be executed after checking dataGroups in:

    if (this.adapter.normalizeUrl(req.url) !== this.indexUrl && this.isNavigationRequest(req)) {

    It can even, IMO, replace the dataGroup implementation since AFAICT dataGroup is one of the uses cases covered by the caching startegies of workbox.

    Also, once workbox is integrated, customisations could be as simple multiple calls of registerRoute in files referenced in angular.json

    Other entrypoint can also be added later for uses cases that different from handling fetch events.

  8. JeanMeche commented on Aug 27, 2025

    @JeanMeche
    Member

    Per #63364, we won't be addressing this issue.

    The message is also visible here: https://angular.dev/ecosystem/service-workers

  9. angular-automatic-lock-bot commented on Sep 27, 2025

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: service-workerIssues related to the @angular/service-worker packagefeatureLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under consideration

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions