-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
"Blob is not defined" error for inline web worker in SSR mode #4462
Comments
a minimal example would be great |
Here's a minimal example: https://github.com/Bastian/vite-ssr-webworker-bug
The code is based on https://github.com/vitejs/vite/tree/main/packages/playground/ssr-react without any notable changes (I just added Vite to the list of dependencies and removed some unnecessary components to make the example simpler). |
Thinking about it for a while, the error makes total sense: NodeJs does not have a built-in |
I ran into this issue, too, when using a module built with Vite together with my Next.js app with SSR. It would be great if a solution could be found that doesn't use |
Describe the bug
I have a Svelte-Kit application that uses Vite under the hood.
When updating my Vite version, I got the following error when building the project and then trying to run it:
The relevant generated code that causes the error looks like this:
Before the update, it looked like this:
(I manually replaced the blob content with
<truncated>
as it's very long and not relevant for the issue).It looks like the change to use blobs was introduced in #3468. This is also when the problem occurred: In version 2.3.3 everything worked fine and in 2.3.4 it no longer does.
I'm not sure, whether or not this change is the root of the issue or just a symptom.
The WebWorker is imported with
import CodeHighlightWorker from "./CodeHighlightWorker?worker&inline";
(complete code). I don't think that its code is relevant, but if it is, you can find it here: CodeHighlightWorker.ts.(Disclaimer: I'm not 100% sure if this is a Vite bug, a Svelte-Kit bug, or simply a bug in my own code/configuration)
Reproduction
This is my repository with the updated Vite version on a separate branch: https://github.com/Bastian/bstats-web/tree/vite-bug
You can clone it and run
to reproduce the bug. If you need a minimal example, I can try to create one.
System Info
The text was updated successfully, but these errors were encountered: