question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Service worker improvements

See original GitHub issue

Do you want to request a feature or report a bug? Feature

What is the current behavior? To make additions in service worker, users currently have to

  1. copy paste the whole sw.js in their src folder.
  2. find apt place to make the change according to their need
  3. make changes amid the 70 lines of code that we have.

What is the expected behavior?

  1. Ugly details of basic service worker setup should be hidden from the users.
  2. Users should be able to import a prebuilt module e.g. preact/sw and initialize it in < 5 LOC.
  3. Advanced users should be able to add functionality on a clean stale environment

If this is a feature request, what is motivation or use case for changing the behaviour? We want to abstract away the basic service worker setup in a module and make improvements to it while users can customize additional functionality on top of it.

Currently the option users have for modifications in sw.js is to copy the entire thing and make changes to it. This makes us loose all control over their service worker for future releases.

P.S: We don’t want to maintain a full fledged SW library. We just want to govern basic setup and be able to ship improvements/library changes to all the basic users without a breaking change in preact-cli. However, this means that it might still be a breaking change for some advanced users, who can pretty much eject from our sw setup anyways.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
prateekbhcommented, Feb 24, 2020

Yes these utilities can be shipped as inbuilt plugins as well

0reactions
prateekbhcommented, Mar 21, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Service Worker improvements - Microsoft Edge Development
This article explains improvements to developer tools for working with service workers and the network requests that pass through each service ...
Read more >
Random notes around service workers development and testing
Jeremy Wagner breaks down the performance improvements obtainable by using service workers. Workbox - Production-ready service worker ...
Read more >
Service workers - web.dev
Service workers are a fundamental part of a PWA. They enable fast loading (regardless of the network), offline access, push notifications, ...
Read more >
Service worker overview - Chrome Developers
Service workers are an enhancement to existing websites. This means that if users on browsers that don't support service workers visit websites ...
Read more >
Boost web performance with Service Workers
If you've been working on the performance of your websites for a while and haven't tried service workers yet, keep reading. A Service...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found