-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document not defined in worker import #17570
Comments
Start a new pull request in StackBlitz Codeflow. |
This minimal reproduction included React and that is not necessary. https://stackblitz.com/edit/vitejs-vite-lblszh |
I am running into a similar issue after upgrading to vite 5. It could be a similar error to one that was fixed in vite 4 #12611 |
Importing CSS files without |
I would expect the CSS to be omitted with a warning during build time. |
Only run DOM operations in the client when there is a document (vitejs#17570)
Hi, I have the same issue! We are migrating from CRA to Vite and this is a show-stopper for us. It is a crucial part, yet it feels silly that we have to not move to Vite just because of this issue. Vite version 6.0.7 |
Describe the bug
While running in dev mode and importing a worker that has dependency on a css file. The worker fails to start with
document not defined
I have created a minimal reproduction of the issue on stackblitz
worker.ts
imported in
App.tsx
Reproduction
https://stackblitz.com/edit/vitejs-vite-t1i3lx
Steps to reproduce
Run
npm install
then runnpm run start
Expected:
console log of Hello world
hash
Actual:
Console throws errors and webWorker fails to start.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: