Skip to content

safety-worker.js: same source code as ngsw-worker.js #24678

Closed

Description

@000panther

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

service-worker

Is this a regression?

No

Description

We are currently trying to get rid of an old service worker using the safety-worker.js. While writing the corresponding scripts for replacing the ngsw-worker.js with the safety-worker.js I noticed that the contents of the files are the same.

I checked the source of https://github.com/angular/angular/tree/15.1.x/packages/service-worker to see if this change might be intentional and the safety-worker.js mentioned there is a small file containing few lines of code.

Out of curiosity i checked the safety-worker.js of angular io - same as the ngsw-worker.js!

https://angular.io/safety-worker.js

https://angular.io/ngsw-worker.js

This seems like an issue. If this is the expected behaviour, the documentation does not mention it.

Please provide a link to a minimal reproduction of the bug

https://github.com/000panther/service-worker-issue

Please provide the exception or error you saw

No response

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

Angular CLI: 15.1.4
Node: 16.15.1
Package Manager: npm 8.11.0
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.4
@angular-devkit/build-angular   15.1.4
@angular-devkit/core            15.1.4
@angular-devkit/schematics      15.1.4
@angular/cli                    15.1.4
@schematics/angular             15.1.4
rxjs                            7.5.7
typescript                      4.9.5

Anything else?

Can I use the safety-worker.js from the service-worker repository as a workaround for now?

Activity

  1. added this to the needsTriage milestone on Feb 8, 2023
  2. alxhub commented on Feb 8, 2023

    @alxhub
    Member

    Hi @000panther,

    I'm going to transfer this to the CLI repo - as far as I can tell, this seems to be a problem with the CLI service worker build process. The @angular/service-worker package itself is shipping the correct contents for safety-worker.js: https://unpkg.com/browse/@angular/[email protected]/safety-worker.js

  3. transferred this issue fromangular/angularon Feb 8, 2023
  4. self-assigned this
    on Feb 8, 2023
  5. 000panther commented on Feb 9, 2023

    @000panther
    Author

    Thanks! I am now serving the file you mentioned as safety-worker.js, and it works perfectly! Would be awesome to get this fixed and have correct funtionality out of the box again.

  6. added 2 commits that reference this issue on Feb 9, 2023
    9c99552
    620032e
  7. added 2 commits that reference this issue on Feb 10, 2023
    d3f2550
    34a4a1b
  8. angular-automatic-lock-bot commented on Mar 13, 2023

    @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.

  9. locked and limited conversation to collaborators on Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions