-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathvite.config.ts
67 lines (62 loc) · 1.44 KB
/
vite.config.ts
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
/// <reference types="vitest" />
import {
defaultClientConditions,
defaultServerConditions,
defineConfig,
} from "vite";
import type { Plugin } from "vite";
import dayjs from "dayjs";
import pkg from "./package.json";
import { reactRouter } from "@react-router/dev/vite";
import tsconfigPaths from "vite-tsconfig-paths";
const prismaFixPlugin: Plugin = {
name: "prisma-fix",
enforce: "post",
config() {
return {
resolve: {
conditions: [...defaultClientConditions],
},
ssr: {
resolve: {
conditions: [...defaultServerConditions],
externalConditions: [...defaultServerConditions],
},
},
};
},
};
const __APP_INFO__ = JSON.stringify({
pkg,
lastBuildTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
});
export default defineConfig(({ isSsrBuild, command }) => ({
build: {
rollupOptions: isSsrBuild
? {
input: "./server/index.js",
external: ["@prisma/client"],
}
: undefined,
},
ssr: {
noExternal: [
"@ant-design/icons",
"@ant-design/pro-chat",
"@ant-design/pro-editor",
"react-intersection-observer",
],
optimizeDeps: {
include: [
"@ant-design/icons",
"@ant-design/pro-chat",
"@ant-design/pro-editor",
"react-intersection-observer",
],
},
},
plugins: [prismaFixPlugin, reactRouter(), tsconfigPaths()],
define: {
__APP_INFO__,
},
}));