ServiceWorker registration failed
Created by: ghost
When running npm run docs, the following happens:
-
bundle exec jekyll build: generates the documentation files. -
node build/workbox.js: which, in turn, performs the following: 2.1 Obtains the location of theworkbox-swmodule currently installed innode_modules. 2.2 Copy the main file obtained in 2.1 togh_pages/assets/js/vendor. With the current version ofworkbox-sw, the path to the copied file would look like this:gh_pages/assets/js/vendor/workbox-sw.prod.v2.1.0.js. 2.3 Read the filesw.jsin the repository root, replace the{fileName}pattern with the file name copied in 2.2 (workbox-sw.prod.v2.1.0.js) and save it in thegh_pagesroot.
Then, when running the documentation server, the index.html page includes <script src="/assets/js/src/pwa.js">. And this script invokes, in turn, the file sw.js created in point 2.3.
So far everything would be OK, but there is a problem when running the test server using `npm run docs-serve'. As Jekyll's documentation mentions (see https://jekyllrb.com/docs/usage/): Destination folders are cleaned on site builds. Then, when executing "npm run docs-serve", when the documentation files are rebuilt, all the work done in point 2 is lost. And, for this reason, the service worker stops working, throwing errors in console.
I am now working on proposing a solution for this. I have to find a way for docs-serve script not to overwrite or delete files generated during docs-compile and postdocs-compile scripts.

