-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
43 lines (38 loc) · 1.2 KB
/
vite.config.js
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
41
42
import react from "@vitejs/plugin-react-swc";
import wasm from "vite-plugin-wasm";
/* import { searchForWorkspaceRoot } from "vite";
import fs from "node:fs";
import path from "node:path"; */
const reloadOnSave = {
name: "full-reload-always",
handleHotUpdate({ server }) {
// by default, vite uses hmr which doesn't work well with imperative handles
server.ws.send({ type: "full-reload" });
return [];
},
};
/** @type {import("vite").UserConfig} */
const config = {
plugins: [react(), wasm(), reloadOnSave],
// https://github.com/rerun-io/rerun/issues/6815
optimizeDeps: {
exclude: process.env.NODE_ENV === "production" ? [] : ["@rerun-io/web-viewer"],
},
build: {
target: "esnext",
},
/* server: {
fs: {
allow: [
searchForWorkspaceRoot(process.cwd()),
// NOTE: hack to allow `new URL("file://...")` in `web-viewer` when it is a linked package
fs.realpathSync(path.join(__dirname, "node_modules", "@rerun-io/web-viewer")),
fs.realpathSync(path.join(__dirname, "node_modules", "@rerun-io/web-viewer-react")),
],
},
}, */
};
if ("REPOSITORY" in process.env) {
config.base = `/${process.env.REPOSITORY}/`;
}
export default config;