Visit the exposed endpoint, and observe that Initializing nitro service worker... is displayed on a blank screen.
Describe the bug
I'm trying to run my Nuxt 3 app with ssr: false using the Nitro service-worker preset, however whenever I deploy to Netlify or look at the local assets generated from yarn build, the only thing displayed on the screen is Initializing nitro service worker....
Additional context
I want to support offline queries to Nuxt content, and it seems like the only way to do that with Nuxt 3 is using the service-worker preset. Because I'm unable to get this working I'm unable to finish my migration from Nuxt 2 to Nuxt 3.
Logs
Browser console logs:
index.js:33 Uncaught TypeError: Cannot read properties of undefined (reading 'split')
at index.js:33:42
at client.manifest.mjs:838:1
at sw.js:1:6
(anonymous) @ index.js:33
(anonymous) @ client.manifest.mjs:838
(anonymous) @ sw.js:1
(index):17 Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('http://localhost:3000/') with script ('http://localhost:3000/sw.js'): ServiceWorker script evaluation failed
Webserver logs (yarn preview)
HTTP 4/1/2023 12:31:45 PM ::1 GET /Users/.../.../.../node_modules/readdirp/index.js
HTTP 4/1/2023 12:31:45 PM ::1 GET /Users/.../.../.../.nuxt/dist/server/client.manifest.mjs
HTTP 4/1/2023 12:31:45 PM ::1 Returned 404 in 3 ms
HTTP 4/1/2023 12:31:45 PM ::1 Returned 404 in 2 ms
Environment
Darwin
v18.12.1
3.3.2
2.3.2
yarn@1.22.19
vite
pages
,css
,ssr
,nitro
,content
,env
,head
,buildModules
,modules
,sentry
,i18n
,pwa
,hooks
,build
,loadingIndicator
@nuxt/content@2.5.2
,@nuxtjs/i18n@8.0.0-beta.10-27995650.c1d4ec9
,@vueuse/nuxt@9.13.0
,@pinia/nuxt@0.4.7
,@pinia-plugin-persistedstate/nuxt@1.0.0
,@nuxtjs/tailwindcss@6.6.0
Build Modules:
-
Reproduction
service-worker
yarn build
followed byyarn preview
Initializing nitro service worker...
is displayed on a blank screen.Describe the bug
I'm trying to run my Nuxt 3 app with
ssr: false
using the Nitroservice-worker
preset, however whenever I deploy to Netlify or look at the local assets generated fromyarn build
, the only thing displayed on the screen isInitializing nitro service worker...
.Additional context
I want to support offline queries to Nuxt content, and it seems like the only way to do that with Nuxt 3 is using the
service-worker
preset. Because I'm unable to get this working I'm unable to finish my migration from Nuxt 2 to Nuxt 3.Logs
Browser console logs:
Webserver logs (
yarn preview
)