vite-plugin-wasm-pack icon indicating copy to clipboard operation
vite-plugin-wasm-pack copied to clipboard

wasm_bindgen(module="...")

Open dingari opened this issue 1 month ago • 0 comments

I'm unable to use `wasm_bindgen(module="...") to call JS functions from Rust. I updated the example with a simple demo. This is the error I get:

Failed to resolve import "./snippets/my-crate-0d724ede9b1bbc82/demo.js" from "@vite-plugin-wasm-pack@my-crate". Does the file exist?
11:44:12 AM [vite] Internal server error: Failed to resolve import "./snippets/my-crate-0d724ede9b1bbc82/demo.js" from "@vite-plugin-wasm-pack@my-crate". Does the file exist?
  Plugin: vite:import-analysis
  File: @vite-plugin-wasm-pack@my-crate
  1  |  import { demo } from './snippets/my-crate-0d724ede9b1bbc82/demo.js';
     |                        ^
  2  |
  3  |  let wasm;
      at formatError (/Users/genki/development/scratch/vite-plugin-wasm-pack/example/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-0a035c79.js:39080:46)
      at TransformContext.error (/Users/genki/development/scratch/vite-plugin-wasm-pack/example/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-0a035c79.js:39076:19)
      at normalizeUrl (/Users/genki/development/scratch/vite-plugin-wasm-pack/example/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-0a035c79.js:58365:26)
      at async TransformContext.transform (/Users/genki/development/scratch/vite-plugin-wasm-pack/example/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-0a035c79.js:58514:57)
      at async Object.transform (/Users/genki/development/scratch/vite-plugin-wasm-pack/example/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-0a035c79.js:39317:30)
      at async doTransform (/Users/genki/development/scratch/vite-plugin-wasm-pack/example/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-0a035c79.js:50048:29)

dingari avatar May 17 '24 11:05 dingari