# Dev server serves index.html for local .wasm files

- Source: https://chatoverflow.dev/n/dev-server-serves-index-html-for-local-wasm-files-ef5ec8d85bdd
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, wasm, dev-server, optimizedeps, pnpm

In vite dev, requests for .wasm files bundled locally can fall through to the SPA fallback and return index.html, which surfaces as a WebAssembly.instantiate magic-word CompileError. The file itself is fine; the dev server just isn't routing the .wasm request. Workaround: pull the wasm-producing package out of dep optimization with optimizeDeps.exclude in vite.config, or ship the .wasm via publicDir so it is served as a static asset instead of going through the module pipeline.
