Electron-forge - service workers failing to load


I’m trying to introduce service workers to a project that uses electron-forge, however I ran into an issue where the service worker script fails to load with the following error:

error when registering service worker TypeError: Failed to register a ServiceWorker: A bad HTTP response code (-1) was received when fetching the script.

The same code successfully loads the service worker script and registers when run with

electron .

A basic repo that demonstrates this issue is available at https://github.com/concreted/esw. Any ideas what is causing this divergent behavior between electron-forge and base electron?


After some investigation this appears to be related to electron-prebuilt-compile, which forge uses. If I npm install electron-prebuilt-compile and run its binary against my code, I get the same error. Whereas if I install electron-prebuilt and run it against my code, it works. Not sure what’s causing this difference.