Incorrect response MIME type. Expected 'application/wasm'.
The browser console reports an error: wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
I am using SolidStart to set up a local-first project. I found electric-sql and am now using its wa-sqlite, which involves wasm. I might need to modify the MIME type, but I am not sure where to configure it.
4 Replies
I guess it's about the vite configuration
Or using import with URL then load
Maybe this Vite plugin will help:
https://github.com/Menci/vite-plugin-wasm#readme
GitHub
GitHub - Menci/vite-plugin-wasm: Add WebAssembly ESM integration (a...
Add WebAssembly ESM integration (aka. Webpack's
asyncWebAssembly
) to Vite and support wasm-pack
generated modules. - Menci/vite-plugin-wasmJust tried adding it to app.config.ts, but it didn't work. I looked for methods like
WebAssembly.instantiateStreaming
in the code of wa-sqlite. I don’t know much about it. It may take more time. I plan to change the method for the time being. Thank you for your suggestion.
I also want to change to import with URL, but this problem occurs inside wa-sqlite, and the compressed mjs is not easy to modify.😭