You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[vite] connecting...
client:614 [vite] connected.
index.mts:1 Uncaught ReferenceError: VERSION is not defined
at index.mts:1:24
(anonymous) @ index.mts:1
localhost/:1 Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('http://localhost:3000/src/sw/') with script ('http://localhost:3000/src/sw/index.mts'): ServiceWorker script evaluation failed
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Vite relies on /@vite/env module during dev to inject define to runtime, but new URL("...". import.meta.url) js assets alone doesn't trigger such injection. Manually writing import "/@vite/env"` seems to work for the provided reproduction.
Since Vite doesn't support service worker out-of-the-box #2248, there's no expected behavior for this situation, so I think we can close this in favor of #2248.
Describe the bug
The global variables described in the define section are not available in the serviceworker
Reproduction
https://github.com/budarin/vite-sw-globals
Steps to reproduce
System Info
Used Package Manager
pnpm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: