forked from dohooo/helmor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.e2e.config.ts
More file actions
67 lines (64 loc) · 2.02 KB
/
vite.e2e.config.ts
File metadata and controls
67 lines (64 loc) · 2.02 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Vite config used only by the Playwright E2E harness. It aliases every
// @tauri-apps/* module the frontend touches to a browser-safe mock under
// src/test/e2e-mocks/*, so the React app can boot in plain WebKit without
// a running Rust backend.
//
// Entry: same `index.html` -> `src/main.tsx`. The only difference from the
// production Vite config is the alias table + a dedicated port.
import path from "node:path";
import babel from "@rolldown/plugin-babel";
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
const MOCK_DIR = path.resolve(__dirname, "./src/test/e2e-mocks");
export default defineConfig({
plugins: [
react(),
babel({
plugins: [["babel-plugin-react-compiler", {}]],
}),
tailwindcss(),
],
resolve: {
dedupe: ["react", "react-dom"],
alias: {
"@": path.resolve(__dirname, "./src"),
react: path.resolve(__dirname, "./node_modules/react"),
"react-dom": path.resolve(__dirname, "./node_modules/react-dom"),
"react/jsx-runtime": path.resolve(
__dirname,
"./node_modules/react/jsx-runtime.js",
),
"react/jsx-dev-runtime": path.resolve(
__dirname,
"./node_modules/react/jsx-dev-runtime.js",
),
"@tauri-apps/api/core": path.resolve(MOCK_DIR, "tauri-core.ts"),
"@tauri-apps/api/event": path.resolve(MOCK_DIR, "tauri-event.ts"),
"@tauri-apps/api/window": path.resolve(MOCK_DIR, "tauri-window.ts"),
"@tauri-apps/api/webview": path.resolve(MOCK_DIR, "tauri-webview.ts"),
"@tauri-apps/plugin-opener": path.resolve(MOCK_DIR, "plugin-opener.ts"),
"@tauri-apps/plugin-dialog": path.resolve(MOCK_DIR, "plugin-dialog.ts"),
"@tauri-apps/plugin-notification": path.resolve(
MOCK_DIR,
"plugin-notification.ts",
),
},
},
optimizeDeps: {
include: [
"react",
"react-dom",
"react/jsx-runtime",
"react/jsx-dev-runtime",
"@tanstack/react-query",
"lucide-react",
],
exclude: ["lexical", "@lexical/react"],
},
clearScreen: false,
server: {
port: 1430,
strictPort: true,
},
});