Skip to content
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

Plugin always bundles Wasm as base64 when vitest is installed #46

Open
willcrichton opened this issue Dec 17, 2023 · 3 comments
Open

Plugin always bundles Wasm as base64 when vitest is installed #46

willcrichton opened this issue Dec 17, 2023 · 3 comments

Comments

@willcrichton
Copy link

I have a Vite app, and I have Vitest installed. When I run vite build, my Wasm file is bundled as base64, even though I want it to be bundled as a URL. This line of code seems to be the problem:

runningInVitest = config.plugins.some(plugin => plugin.name === "vitest");

I guess the config plugins includes vitest even when I'm not using it?

@Menci
Copy link
Owner

Menci commented Dec 17, 2023

Oh... So how can I detect if it's actually running in Vitest environment?

@willcrichton
Copy link
Author

I don't know, sorry. Otherwise I would propose a fix :')

@jbordenHighRezConsulting

I am having the same issue as @willcrichton and decided to do some more digging and believe that this is not the issue.
You can run vite build --debug and it will print out the config with the list of plugins it is using and is the same array of values used in the line @willcrichton shows in the original post.

Not sure what the issue is, but my .wasm file made using wasm-pack --target web is also being inlined as a base64 string and I can't figure out what in Vite is doing it. It happens even without this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants