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.

Custom ServiceWorker config

See original GitHub issue

1.0.0 added Progressive Web App support, is it possible to support custom config in near future? I really don’t want to eject just to add runtime caching configs 😄

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
dsghcommented, May 19, 2017

@Timer I just updated to the newest version, and tried to use the new PWA support as well, and there seems to be an issue with Firebase auth. Firebase auth uses the /__/auth/handler path, which seems to be ‘cached’ by the default config (returning the app itself). So for now I had to abandon the idea. Here’s what I believe to be a related issue, for the polymer project: https://github.com/Polymer/polymer-build/issues/35#issuecomment-245981301

3reactions
jeffposnickcommented, May 19, 2017

There are definitely use cases where folks might want something other than the default configuration. I tried to choose default configuration options that are, in general safe, with the understanding that developers who need to make changes will go through the eject flow and modify the configuration (which seemed to in keeping with the overall approach for this project).

I don’t know how common it is for servers to use the /__ prefix for “special” URLs that are server-rendered and shouldn’t be fulfilled via the locally cached content, but adding in the configuration option

{
  navigateFallbackWhitelist: [/^(?!\/__)/]
}

would account for them. Doing so would be unlikely to break anyone, and it would accommodate some of the folks upthread without forcing them to eject.

As for the questions about configuring runtimeCaching, I tried to cover that in item 7 of this guide. There’s no single configuration option that’s likely to work for everyone, so using the eject flow would be the way forward.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Service Workers - Web APIs | MDN
A service worker functions like a proxy server, allowing you to modify requests and responses replacing them with items from its own cache....
Read more >
Service worker configuration - Angular
This topic describes the properties of the service worker configuration file. ... This optional section enables you to specify a custom list of...
Read more >
How to implement Custom Service worker in create-react-app ...
Note: This post only cover about how we can configure our custom service worker in our react app which is developed using create-react-app....
Read more >
Customizing Service Workers in ReactJS Progressive Web ...
Learn how to customize Google Workbox's default behavior for a service worker in your React app. This articles explains how to modify the ......
Read more >
How to build a PWA with Create-React-App and custom ...
Take a look at these GitHub issues to see why the team at CRA won't support customising the default service worker. Custom ServiceWorker...
Read more >

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