Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
49 lines (45 loc) · 1.53 KB
/
Copy pathvite.config.ts
File metadata and controls
49 lines (45 loc) · 1.53 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
41
42
43
44
45
46
47
48
49
/// <reference types="vitest/config" />
import { defineConfig, type Plugin } from "vite";
import react from "@vitejs/plugin-react";
// Dev-only: inject the standalone React DevTools connect script into <head>,
// BEFORE the app module runs so the DevTools hook is installed before React
// mounts. `apply: "serve"` guarantees this never lands in a production build.
// Requires the standalone GUI running first: `pnpm devtools` (port 8097).
// If the GUI isn't up the script simply fails to connect — the app is fine.
function reactDevtools(): Plugin {
return {
name: "bytetable:react-devtools",
apply: "serve",
transformIndexHtml() {
return [
{
tag: "script",
attrs: { src: "http://localhost:8097" },
injectTo: "head-prepend",
},
];
},
};
}
// https://vite.dev/config/
export default defineConfig({
plugins: [reactDevtools(), react()],
// Vite options tailored for Tauri development.
// 1. prevent Vite from obscuring Rust errors
clearScreen: false,
// 2. Tauri expects a fixed port; fail if that port is not available
server: {
port: 1420,
strictPort: true,
watch: {
// 3. tell Vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
// Vitest reads this file too. The suites are PURE LOGIC (`*.test.ts` next to
// the module they cover) — no components, no DOM — so the default `node`
// environment is right; a component test would have to opt into jsdom.
test: {
include: ["src/**/*.test.ts"],
},
});