You're using Google's sw-precache library to generate a service worker file on the fly, which is awesome 🙌 🎉
Although the service worker gets generated right to the deployment folder, the app doesn't try looking for the file and register it. This snippet will check if the browser allows service worker usage and if so, register it so the app can work offline.
Also added a noscript tag to pop a message if the user has JS disabled - a better solution for this would be relying on server side rendering some of the content so at least we can have graceful degradation for users without JS (but that's a discussion for a different time - need to outweigh the effort/benefits of course :)
You're using Google's
sw-precache
library to generate a service worker file on the fly, which is awesome 🙌 🎉Although the service worker gets generated right to the deployment folder, the app doesn't try looking for the file and register it. This snippet will check if the browser allows service worker usage and if so, register it so the app can work offline.
Also added a
noscript
tag to pop a message if the user has JS disabled - a better solution for this would be relying on server side rendering some of the content so at least we can have graceful degradation for users without JS (but that's a discussion for a different time - need to outweigh the effort/benefits of course :)