Service worker - Uncaught ReferenceError: window is not defined #17882
Labels
area/cli
area/plugins
bug/2-confirmed
We have reproduce the problem and confirmed that this is a bug.
flavour/quasar-cli-vite
kind/bug 🐞
mode/pwa
Qv2 🔝
Quasar v2 issues
What happened?
When trying to import and use quasar utils or plugin functions in a server worker we get a "Uncaught ReferenceError: window is not defined".
Example, try to do this in
custom-service-worker.js
:What did you expect to happen?
uid
I didn't expect thePlatform
plugin to get included too__QUASAR_SSR_SERVER__
should be true (https://github.com/quasarframework/quasar/blob/dev/ui/src/plugins/platform/Platform.js#L63) if someone wants to use thePlatform
plugin in a (service)worker context? (there is no window there)Reproduction URL
https://stackblitz.com/edit/quasarframework-stackblitz-templates-tahv4cm3?file=src-pwa%2Fcustom-service-worker.js
How to reproduce?
InjectManifest
modeFYI The stackblitz example give you an idea of the code however it looks like service workers do not actually work in such an environment?
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite), Plugins (quasar), PWA Mode
Platforms/Browsers
Chrome, Firefox
Quasar info output
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: