Skip to content

Commit

Permalink
Migrate to rollup-plugin-rust
Browse files Browse the repository at this point in the history
  • Loading branch information
WilsonGramer committed Jul 29, 2023
1 parent 869ceb9 commit 0915ada
Show file tree
Hide file tree
Showing 12 changed files with 615 additions and 97 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }

[target.'cfg(target_arch = "wasm32")']
rustflags = ["-C", "link-arg=--max-memory=4294967296"]
1 change: 1 addition & 0 deletions website/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react-swc": "^3.0.0",
"@wasm-tool/rollup-plugin-rust": "^2.4.0",
"autoprefixer": "^10.4.13",
"nodemon": "^2.0.20",
"postcss": "^8.4.21",
Expand Down
13 changes: 4 additions & 9 deletions website/embed/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
import rust from "@wasm-tool/rollup-plugin-rust";
import { rustOptions } from "../shared/build";
import path from "path";
import pkg from "./package.json";

Expand All @@ -17,14 +17,9 @@ export default defineConfig(({ command, mode }) => {
formats: ["es"],
},
},
plugins: [react(), wasm(), topLevelAwait()],
plugins: [react(), rust(rustOptions(env))],
worker: {
plugins: [wasm(), topLevelAwait()],
rollupOptions: {
output: {
inlineDynamicImports: true,
},
},
plugins: [rust(rustOptions(env))],
},
server: {
port: 3000,
Expand Down
Loading

0 comments on commit 0915ada

Please sign in to comment.