-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
81 lines (77 loc) · 1.94 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { fileURLToPath, URL } from "node:url";
// https://react-svgr.com/docs/rollup/
import svgr from "@svgr/rollup";
import react from "@vitejs/plugin-react";
import dns from "dns";
import { defineConfig } from "vite";
import checker from "vite-plugin-checker";
dns.setDefaultResultOrder("verbatim");
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const isTest = mode === "test";
return {
optimizeDeps: {
esbuildOptions: {
target: "es2020",
},
},
esbuild: {
// https://github.com/vitejs/vite/issues/8644#issuecomment-1159308803
logOverride: { "this-is-undefined-in-esm": "silent" },
},
plugins: [
react({
babel: {
plugins: [
"babel-plugin-macros",
[
"@emotion/babel-plugin-jsx-pragmatic",
{
export: "jsx",
import: "__cssprop",
module: "@emotion/react",
},
],
[
"@babel/plugin-transform-react-jsx",
{ pragma: "__cssprop" },
"twin.macro",
],
[
"babel-plugin-import",
{
libraryName: "@mui/material",
libraryDirectory: "",
camel2DashComponentName: false,
},
"core",
],
],
},
}),
svgr({
icon: true,
dimensions: false,
}),
!isTest
? checker({
typescript: true,
enableBuild: false,
})
: undefined,
],
server: {
port: 9090,
watch: {
usePolling: true,
},
},
resolve: {
alias: {
"~": fileURLToPath(new URL("./", import.meta.url)),
"@": fileURLToPath(new URL("./src", import.meta.url)),
"@img": fileURLToPath(new URL("./src/assets/img", import.meta.url)),
},
},
};
});