GoogleChromeLabs / pwa-workshop-codelab

Apache License 2.0
155 stars 206 forks source link

Uncaught SyntaxError: The requested module /service-worker.js does not provide an export named 'default' #7

Open tostinni opened 2 years ago

tostinni commented 2 years ago

After setting up step 3 of the PWA training and fill up service-worker.js we have this error in the console.

Uncaught SyntaxError: The requested module /service-worker.js does not provide an export named 'default'

Any idea how to fix this ?

DSergii commented 12 months ago

Any updates after two years? I have got the same error.

DiegoRicardoValdiviaArreola commented 5 months ago

In my case I was following the codelab in spanish and it had this line in the main.js file: import swURL from 'sw:../service-worker.js';

and below it says this: The import syntax for the service worker URL is required so that our build tool, WMR, can build the service worker correctly. If you don't use WMR, set swURL as the path to your service worker.

So I changed the import line to this and is working now 👍 : const swURL = '../service-worker.js';