Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
000panther opened this issue Feb 8, 2023 · 3 comments · Fixed by #24684
Closed

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

000panther opened this issue Feb 8, 2023 · 3 comments · Fixed by #24684

Comments

@000panther
Copy link

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?

@ngbot ngbot bot added this to the needsTriage milestone Feb 8, 2023
@alxhub
Copy link
Member

alxhub commented Feb 8, 2023

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/service-worker@15.1.3/safety-worker.js

@000panther
Copy link
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.

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Feb 9, 2023
… contents

Previously, `safety-worker.js` and `worker-basic.min.js` contained incorrect data due to an incorrect path.

Closes angular#24678
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Feb 9, 2023
… contents

Previously, `safety-worker.js` and `worker-basic.min.js` contained incorrect data due to an incorrect path.

Closes angular#24678
angular-robot bot pushed a commit that referenced this issue Feb 10, 2023
… contents

Previously, `safety-worker.js` and `worker-basic.min.js` contained incorrect data due to an incorrect path.

Closes #24678
angular-robot bot pushed a commit that referenced this issue Feb 10, 2023
… contents

Previously, `safety-worker.js` and `worker-basic.min.js` contained incorrect data due to an incorrect path.

Closes #24678

(cherry picked from commit d3f2550)
@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 Mar 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.