-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
35 lines (34 loc) · 1.16 KB
/
vite.config.ts
File metadata and controls
35 lines (34 loc) · 1.16 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
/// <reference types="vitest/config" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vite.dev/config/
export default defineConfig({
plugins: [
react({
babel: {
plugins: [["babel-plugin-react-compiler"]],
},
}),
],
server: {
proxy: {
"/api": {
target: "http://localhost:5001", // Your Express server port
changeOrigin: true,
// The rewrite rule is optional, but often useful if your Express routes
// don't include the '/api' prefix, e.g., Express route is just '/data'
// rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
test: {
// Enable global API like `describe`, `it`, `expect` without explicit imports
globals: true,
// Use jsdom for simulating a browser environment
environment: "jsdom",
// Path to your setup file (we'll create this next)
setupFiles: "./src/setupTests.js", // or './src/setupTests.ts'
// Optional: add a reference for vitest types if using TypeScript
// If you encounter an error with 'defineConfig', you might need to import it from 'vitest/config' instead of 'vite'
},
});