Open Nedimko123 opened 8 months ago
And is it possible to create something similiar with your own service-worker.ts:
/*
* WHAT IS THIS FILE?
*
* The service-worker.ts file is used to have state of the art prefetching.
* https://qwik.builder.io/qwikcity/prefetching/overview/
*
* Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
* You can also use this file to add more functionality that runs in the service worker.
*/
import { setupServiceWorker } from '@builder.io/qwik-city/service-worker'
setupServiceWorker()
addEventListener('install', () => self.skipWaiting())
addEventListener('activate', () => self.clients.claim())
declare const self: ServiceWorkerGlobalScope
This is most likely not related to Qwik but to Vite. Try with different Vite versions, v4/v5 and run the build with the environment DEBUG=*
Tested with "vite": "5.1.4", and "vite": "4.4.6", still the same issue
Did the DEBUG=* help with showing what is going on? Does it work in dev mode?
Well that's the thing it works completely fine in dev mode, debug doesn't say anything, it just gets stuck at built client modules...
Here is the error both if I put as a normal or dev dependancy:
error during build:
Error: No usable method found in ["native","idb","localstorage"]
at yk (file:///home/nedim/Documents/Motism/REI/frontend_mono/apps/reiprint/.vercel/output/functions/_qwik-city.func/assets/@qwik-city-plan-00616d92.js:100:56987)
at new _0 (file:///home/nedim/Documents/Motism/REI/frontend_mono/apps/reiprint/.vercel/output/functions/_qwik-city.func/assets/@qwik-city-plan-00616d92.js:100:57195)
at file:///home/nedim/Documents/Motism/REI/frontend_mono/apps/reiprint/.vercel/output/functions/_qwik-city.func/assets/@qwik-city-plan-00616d92.js:100:59330
at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:308:24)
at async createSingleThreadWorker (file:///home/nedim/Documents/Motism/REI/frontend_mono/node_modules/.pnpm/@builder.io+qwik-city@1.1.5/node_modules/@builder.io/qwik-city/static/node.mjs:124:14)
at async createNodeMainProcess (file:///home/nedim/Documents/Motism/REI/frontend_mono/node_modules/.pnpm/@builder.io+qwik-city@1.1.5/node_modules/@builder.io/qwik-city/static/node.mjs:372:30)
at async mainThread (file:///home/nedim/Documents/Motism/REI/frontend_mono/node_modules/.pnpm/@builder.io+qwik-city@1.1.5/node_modules/@builder.io/qwik-city/static/node.mjs:879:16)
at async Module.generate (file:///home/nedim/Documents/Motism/REI/frontend_mono/node_modules/.pnpm/@builder.io+qwik-city@1.1.5/node_modules/@builder.io/qwik-city/static/node.mjs:1071:20)
at async Module.generate (/home/nedim/Documents/Motism/REI/frontend_mono/node_modules/.pnpm/@builder.io+qwik-city@1.1.5/node_modules/@builder.io/qwik-city/static/index.cjs:28:18)
ELIFECYCLE Command failed with exit code 1.
Seems like something wants to store stuff using client side storage options. What is that?
I mean I literally installed https://www.npmjs.com/package/broadcast-channel and did this to show you that error:
import { BroadcastChannel } from 'broadcast-channel';
const channel = new BroadcastChannel('foobar');
You're running the broadcast-channel code in the server. You need to encapsulate it so it only runs on the client.
@Nedimko123 Did you solve your issue with @wmertens solution?
Hello @Nedimko123. Please provide the missing information requested above.
Issues marked with STATUS-2: missing info
will be automatically closed if they have no activity within 14 days.
Thanks 🙏
@gioboa No
Do you have a public repository to clone and check the problem?
it gets stuck at built client modules