tr1s / tris-webpack-boilerplate

A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
https://twbp.tris.codes/
MIT License
1.02k stars 97 forks source link

No matching service worker detected #34

Closed kingstonelibrary closed 4 years ago

kingstonelibrary commented 4 years ago

I just cloned this repo and compiled it. Then I tested it in my GitHUB page The problem was that the installation banner didn't appear on my Android. Checking the site I came across the following error

Google Chrome v80 DevTool - Application - Manifest "No matching service worker detected"

then, I added the following code in the main script file,but didn't work. I mean I have still the above problem

 document.addEventListener('DOMContentLoaded', function() {

  if ('serviceWorker' in navigator) {

    navigator.serviceWorker.register('./sw.js').then(function(reg) {

        console.log('Successfully registered service worker', reg);

    }).catch(function(err) {

        console.warn('Error whilst registering service worker', err);

    });
    }
});

the above successful message was displayed in the console. but the above error didn't disappear... How can I fix this ?

kingstonelibrary commented 4 years ago

I modified "start_url" in manifest.json to a simple one like "./" Then it was fixed