I keep receiving sw.js 404 not found. It's not in the static folder either with the install. Installed it with npm install.
sw.js 404 for me too with nuxt-edge after nuxt build.
I'm trying pwa-module now and I'm a little lost here (that is, I'm not sure if I'm missing something or just found a bug.. 😃 )
I think/believe sw.js should be created on build time to point to the current files recently generated, isn't that ? It's working just like that for OneSignal files…
I had a sw.js file but it imported an invalid script (what I thought was a bug also)… then I removed sw.js, hoping It would generate but it's not generated again…
I have this configuration:
description: 'Testing PWA App'
appId: process.env.ONE_SIGNAL_ID || 'foobar',
Did anyone ever figure this out? I'm getting load failures on onesignal scripts. Can't determine if they're related to the fact that no sw.js file is generated.
Hi guys! did you tried to create manually static/sw.js (empty) file? https://pwa.nuxtjs.org/setup
I had the same issue, but after doing a npm run generate a sw.js was created.
npm run generate
Same issue here too.. interesting, I had one locally, but on my deployment (where gitignore is used that this file does not exist), it's never created. Just tested it locally gain, removed the sw.js file, and started npm run build => no sw.js file has been created? Is there a different approach to generate this file now?
Can somebody narrow it down to a specific version or commit?
I suspect some of confusion in this ticket might be due to fact that sw.js generated inside static folder, not in .nuxt/dist
Had this issue around my app deployement through a CI Pipeline, cause I wasn't telling to my Pipeline job to cache/artifact the static folder but only node_modules & .nuxt, so the generated sw.js wasn't here in my deployment step (as @aldarund said, the sw.js will result in static and not .nuxt/dist). Fixed it simply adding the static folder in the saved artifacts between my jobs (I'm using GitLab CI)
Good catch @aldarund and @kevinmarrec!
Closing the issue ☺️
The service worker (sw.js) file will be created directly in the static file. You might have to copy it over if you have a deploy pipeline.