-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathvite.config.ts
More file actions
76 lines (69 loc) · 1.88 KB
/
vite.config.ts
File metadata and controls
76 lines (69 loc) · 1.88 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
68
69
70
71
72
73
74
75
76
/// <reference types="vitest/config" />
import path from "node:path";
import babel from "@rolldown/plugin-babel";
import tailwindcss from "@tailwindcss/vite";
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import compression from "vite-plugin-compression";
export default defineConfig(async ({ mode }) => {
const isPages = mode === "pages";
return {
base: isPages ? "/sqlite-online/" : "/",
plugins: [
react(),
await babel({ presets: [reactCompilerPreset()] }),
tailwindcss(),
compression()
],
build: {
rollupOptions: {
output: {
manualChunks(id: string) {
if (!id.includes("node_modules")) {
return undefined;
}
const pkg = id.split("node_modules/")[1]?.split("/")[0];
if (!pkg) return undefined;
// Merge tiny always-loaded packages into one chunk to cut HTTP
// requests (each was under 1.5 KB on its own).
if (
pkg === "@babel" ||
pkg === "rolldown" ||
pkg === "rolldown-runtime" ||
pkg === "class-variance-authority" ||
pkg === "clsx" ||
pkg === "zustand"
) {
return "vendor-core";
}
return pkg;
}
}
}
},
optimizeDeps: {
exclude: [
"react-window",
"react-virtualized-auto-sizer",
"react-resizable-panels"
]
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src")
}
},
server: {
fs: {
allow: [path.resolve(__dirname), path.resolve(__dirname, "..")],
strict: false
}
},
test: {
environment: "jsdom",
setupFiles: ["./src/test/setup.ts"],
clearMocks: true,
restoreMocks: true
}
};
});