Menci / vite-plugin-wasm

Add WebAssembly ESM integration (aka. Webpack's `asyncWebAssembly`) to Vite and support `wasm-pack` generated modules.
MIT License
281 stars 16 forks source link

Not found: /node_modules/.vite/deps/<package>_bg.wasm #14

Closed Niedzwiedzw closed 1 year ago

Niedzwiedzw commented 1 year ago

I use vite 3.1, and I'm trying to use this project to load wasm-pack created package. I'm doing

wasm-pack build <package> --target web
wasm-pack pack <package> 
yarn add ./<package>/pkg/<pkg>-<version>.tgz

typescript is fine with this, I'm not getting errors so the package is there. When I inspect node_modules, all the files are also there. but for some reason, in .vite/deps/ there's just the .js files (no sign of *_bg.wasm files) here's the full error:

Not found: /node_modules/.vite/deps/wasm_launcher_extensions_bg.wasm
Error: Not found: /node_modules/.vite/deps/wasm_launcher_extensions_bg.wasm
    at resolve (file:///C:/Users/niedzwiedz-serwer/blazing-client/node_modules/@sveltejs/kit/src/runtime/server/index.js:267:13)
    at Object.handle (file:///C:/Users/niedzwiedz-serwer/blazing-client/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:336:66)
    at respond (file:///C:/Users/niedzwiedz-serwer/blazing-client/node_modules/@sveltejs/kit/src/runtime/server/index.js:295:40)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///C:/Users/niedzwiedz-serwer/blazing-client/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:406:22

this happens when I run yarn dev

Menci commented 1 year ago

Use --target bundler. Don't use --target web.