-
Notifications
You must be signed in to change notification settings - Fork 30
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
Mock SwPush and SwUpdate in development #3
Comments
Hello I have made a work-around for this. You can find it in my repo: https://github.com/maciejtreder/angular-universal-pwa What i have done is just empty "fake" file with service worker code, name same as production one In my development build I am using
|
Hello! Thank you for sharing the solution! |
@webmaxru You're welcome! You should now, that you are the person who got me interested in Angular (at Devoxx Poland 2016)! I would be more then happy if you would like to review my repo and place your comments! Of course, the star from you would be more than appreciating! |
Hi, thank you, it's a simple and clean solution 👍 Just register an empty service worker in development. |
Here is the code I used to register an empty service worker:
|
@maciejtreder, awesome mock! It worked, and I will use it for testing. Right after I got your mock working I saw that we can enable the ServiceWorkerModule only for production like this:
it's a bit cleaner in my AppModule IMO. "[@]angular/service-worker": "^5.2.9", |
Will check ‘enable’ option. It would be much better then mocking. |
With
ng serve
I get "No provider for SwPush" and "No provider for SwUpdate" because the ServiceWorkerModule is only registered in production environment:Can SwPush and SwUpdate be mocked in development mode somehow?
The text was updated successfully, but these errors were encountered: