web search done right
build wasm during 'just setup' and make sure pkg has a package.json file. see https://github.com/rustwasm/wasm-pack/issues/965
Mikkel Denker7d870b270282
diff --git a/crates/client-wasm/Cargo.toml b/crates/client-wasm/Cargo.tomlindex 4ad33e9d..e4e1c553 100644--- a/crates/client-wasm/Cargo.toml+++ b/crates/client-wasm/Cargo.toml@@ -1,19 +1,29 @@[package]+edition = "2021"name = "client-wasm"version = "0.1.0"-edition = "2021"+wasm-opt = false++[package.metadata.wasm-pack.profile.release]+wasm-opt = false++[package.metadata.wasm-pack.profile.dev]+wasm-opt = false++[package.metadata.wasm-pack.profile.profiling]+wasm-opt = false[lib]crate-type = ["cdylib", "rlib"][dependencies]js-sys = "0.3.60"-serde = { version = "1.0.137", features = ["rc", "derive"] }-serde_json = "1.0"+serde = {version = "1.0.137", features = ["rc", "derive"]}serde-wasm-bindgen = "0.6.3"+serde_json = "1.0"thiserror = "1.0.31"wasm-bindgen = "0.2.83"-optics = { path = "../optics" }+optics = {path = "../optics"}[workspace]diff --git a/frontend/package.json b/frontend/package.jsonindex 6b738dfb..b3c11528 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -55,8 +55,7 @@"vite": "^5.1.4","vite-plugin-top-level-await": "^1.4.1","vite-plugin-wasm": "^3.3.0",- "vitest": "^1.0.4",- "client-wasm": "file:../crates/client-wasm/pkg"+ "vitest": "^1.0.4"},"type": "module","dependencies": {@@ -65,9 +64,10 @@"highlight.js": "^11.9.0","lz-string": "^1.5.0","tailwind-merge": "^2.1.0",- "ts-pattern": "^5.0.6"+ "ts-pattern": "^5.0.6",+ "client-wasm": "file:../crates/client-wasm/pkg"},"engines": {- "node": "20.10.x"+ "node": "^20.10.x"}}diff --git a/justfile b/justfileindex d467b77b..9a8aedb7 100644--- a/justfile+++ b/justfile@@ -23,7 +23,8 @@ export STRACT_CARGO_ARGS := env_var_or_default("STRACT_CARGO_ARGS", "")cd frontend && npm run openapi@setup *ARGS:- python3 -m venv .venv || true+ cd crates/client-wasm && wasm-pack build --target web+ just setup_python_env@prepare_models:just setup_python_env