Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

handleFetch not working #350

Open
redixhumayun opened this issue Mar 16, 2018 · 6 comments
Open

handleFetch not working #350

redixhumayun opened this issue Mar 16, 2018 · 6 comments

Comments

@redixhumayun
Copy link

My sw-precache-config file is listed as below

module.exports = {
    staticFileGlobs: [
        'build/**.png',
        'build/vega-icons/**', 
        'build/static/**'
    ],
    swFilePath: './build/service-worker.js', 
    templateFilePath: './service-worker.tmpl', 
    stripPrefix: 'build/', 
    handleFetch: false
}

I am using the template file provided in the src code locally.

Even with the handleFetch flag set to false, I am still seeing the fetch event listener being added to the output service worker.

@mbj36
Copy link
Contributor

mbj36 commented Mar 16, 2018

Can you try removing the output service worker and then regenerate ?

@mbj36
Copy link
Contributor

mbj36 commented Mar 16, 2018

By the way, if you are starting out, then you should try Workbox

@redixhumayun
Copy link
Author

@mbj36 - The reason I am choosing the sw-precache over Workbox is because I am using service workers with the CRA build. I believe that is configured using sw-precache?

@redixhumayun
Copy link
Author

@mbj36 - By removing the output service worker, I assume you mean remove the swFilePath from the config file? If so, no that does not work. I get the same output as before.

@dfranusic
Copy link

I am facing the same issue. I have just started with CRA and PWA and sw-preache (as @redixhumayun stated) is the best option to customize CRA auto generated service worker.

dfranusic pushed a commit to dfranusic/sw-precache that referenced this issue Aug 23, 2018
@ray007
Copy link

ray007 commented Mar 8, 2019

By the way, if you are starting out, then you should try Workbox

I really hope this project will continue. Workbox is a kitchen-sink with everything in it, sw-precache creates a self-contained script of 11kB before minimizing for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants