Skip to content

InjectionToken SwRegistrationOptions is ignored when using standalone bootstrapApplication function. #57824

@antur84

Description

@antur84

Which @angular/* package(s) are the source of the bug?

service-worker

Is this a regression?

Yes

Description

Hi, I've made a little repo to illustrate the issue.

When using the old NgModule based syntax to init your app with a service worker, then your provided SwRegistrationOptions is found and respected.

Runing the app gives you a console log.

When using standalone app syntax, via bootstrapApplication then your provided SwRegistrationOptions is not not found nor respected. Runing the app does not give you a console log.

Likely it was overlooked in the PR where the provideServiceWorker function was added. Or perhaps I'm just misunderstanding how it's supposed to work now.

Please provide a link to a minimal reproduction of the bug

https://github.com/antur84/sw-registration-options-bug/commits/main/

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 18.2.4
Node: 20.16.0
Package Manager: npm 10.8.1
OS: win32 x64

Angular: 18.2.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions