jj bookmark set main —allow-backwardsAdds the following to package.json:
"dependencies": {
"my-rust-crate": "file:../my-rust-crate/pkg"
},
"devDependencies": {
"vite-plugin-top-level-await": "^1.6.0",
"vite-plugin-wasm": "^3.5.0"
}In vite.config.ts:
import {defineConfig} from "vite";
import topLevelAwait from "vite-plugin-top-level-await";
import wasm from "vite-plugin-wasm";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [wasm(), topLevelAwait()],
})Inside the ../my-rust-crate/pkg, run
wasm-pack build --releaseThere are some misinformation, but there is no need to pass the
--target webflag
Then our wasm file will be ready to use for the web project.