Reputation: 2040
I am using the progressive web app module from Drupal and it loads the file from /pwa/serviceworker.js
Reading this article it says you need to load the Service worker from root https://frustrated.blog/2016/07/17/pwa_step_one.html and https://github.com/GoogleChromeLabs/sw-toolbox/issues/158
Can I load the service worker from anywhere? say modules/pwa/js/serviceworker.js ?
It seems to be working that way
Upvotes: 1
Views: 1634
Reputation: 914
If you load a service worker in /modules/pwa/js, it can only manage resources under this path. So, you have to place your SW at the root of your public path. A solution is to use url rewrite with an htaccess file for example.
Upvotes: 4