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
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.
Describe the bug
When the origin value is null, calling some APIs can trigger SecurityError or Cross-Origin error.
For example, executing await navigator.storage.getDirectory()
will throw the error: Error: SecurityError: Storage directory access is denied.
The reason is that a WebWorker was created using a Data URL.

The corresponding Vite code is at: https://github.com/vitejs/vite/blob/7b240e408ed83f172e9f88823eae3b4a9ba92674/packages/vite/src/node/plugins/worker.ts#L326C28-L326C38
I tried replacing self with window, which resolved the issue.
Reproduction
https://stackblitz.com/edit/vitejs-vite-hfhdfg?file=main.js
Steps to reproduce
npm run build
dist/assets/index-[hash].js
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: