Sitemap
1 min readJul 13, 2020

Hi,

thank you for the question.

You have many possibilities, choose the one that more fits your needs.

1. Register and use 2 different service workers. The one of CRA for caching and the other for push notifications. Think of it as two "pieces of the code base" doing two different things. In this case, service-worker file names must to be unique.

2. Remove the CRA service worker and add the caching logic to the push notification one. In this case, you have to implement the caching logic (not really a funny thing).

3. Add the push notification logic in the CRA service worker, this is a little bit harder because the service worker file is generated by a webpack plugin, so you have to eject the project and edit the plugin config. Not sure if this is possible.

I'd definitely choose the first solution.

Lorenzo Spyna
Lorenzo Spyna

Written by Lorenzo Spyna

💻Writes web2 and web3 code | 🚀 firenze.dev co-founder | 🥑 0xpolygon Advocate — https://spyna.it

No responses yet