-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
62 lines (58 loc) · 1.77 KB
/
Copy pathvite.config.js
File metadata and controls
62 lines (58 loc) · 1.77 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
import path from "path"
import { fileURLToPath } from "url"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite-plus"
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
plugins: [
react(),
{
name: "normalize-react-transform-config",
config(config) {
config.oxc ??= {}
config.oxc.jsx ??= {}
if (!config.oxc.jsx.runtime) config.oxc.jsx.runtime = "automatic"
if (!config.oxc.jsx.importSource) config.oxc.jsx.importSource = "react"
config.optimizeDeps ??= {}
config.optimizeDeps.rolldownOptions ??= {}
config.optimizeDeps.rolldownOptions.transform ??= {}
config.optimizeDeps.rolldownOptions.transform.jsx ??= {}
if (!config.optimizeDeps.rolldownOptions.transform.jsx.runtime) {
config.optimizeDeps.rolldownOptions.transform.jsx.runtime = "automatic"
}
if (!config.optimizeDeps.rolldownOptions.transform.jsx.importSource) {
config.optimizeDeps.rolldownOptions.transform.jsx.importSource = "react"
}
if ("esbuild" in config) delete config.esbuild
if (config.optimizeDeps && "esbuildOptions" in config.optimizeDeps) {
delete config.optimizeDeps.esbuildOptions
}
},
},
tailwindcss(),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
port: 1420,
strictPort: true,
},
clearScreen: false,
run: {
enablePrePostScripts: true,
tasks: {
build: {
command: "vp build",
input: ["src/**", "public/**", "index.html", "vite.config.js"],
},
check: {
command: "vp check",
input: ["src/**"],
},
},
},
})