-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathvite.config.js
More file actions
40 lines (39 loc) · 1.05 KB
/
vite.config.js
File metadata and controls
40 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { defineConfig } from "vite";
import { exec } from "node:child_process";
export default defineConfig({
server: {
headers: {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
},
},
build: {
rolldownOptions: {
checks: {
pluginTimings: false, // cargo can take a moment to build, 3 seconds is a bit tight
},
},
},
plugins: [
{
name: "cargo-build",
buildStart: () => {
return new Promise((resolve, reject) => {
exec(
"cargo build --target=wasm32-unknown-unknown --release --quiet;\
wasm-bindgen --target web --out-dir public/ target/wasm32-unknown-unknown/release/ornithe-installer-rs.wasm",
(err, stdout, stderr) => {
if (err) {
console.log("Stdout:", stdout);
console.log("Stderr:", stderr);
reject(err);
} else {
resolve();
}
},
);
});
},
},
],
});