2026-06-14 01:07:48 +08:00
|
|
|
import path from "node:path"
|
|
|
|
|
import react from "@vitejs/plugin-react"
|
2026-08-10 02:55:49 +08:00
|
|
|
import { defineConfig, loadEnv } from "vite"
|
2026-06-14 01:07:48 +08:00
|
|
|
|
2026-08-10 02:55:49 +08:00
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
|
const env = loadEnv(mode, process.cwd(), "")
|
|
|
|
|
const apiTarget = env.VITE_API_TARGET || "http://localhost:8080"
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
plugins: [react()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
"@": path.resolve(__dirname, "./src"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
port: 5173,
|
|
|
|
|
proxy: {
|
|
|
|
|
"/api": apiTarget,
|
|
|
|
|
"/healthz": apiTarget,
|
|
|
|
|
},
|
2026-06-14 01:07:48 +08:00
|
|
|
},
|
2026-08-10 02:55:49 +08:00
|
|
|
build: {
|
|
|
|
|
rolldownOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
codeSplitting: {
|
|
|
|
|
groups: [
|
|
|
|
|
{
|
|
|
|
|
name: "prosemirror",
|
|
|
|
|
test: /node_modules[\\/]prosemirror-/,
|
|
|
|
|
priority: 30,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "tiptap",
|
|
|
|
|
test: /node_modules[\\/]@tiptap/,
|
|
|
|
|
priority: 20,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-06-14 01:07:48 +08:00
|
|
|
},
|
2026-08-10 02:55:49 +08:00
|
|
|
}
|
2026-06-14 01:07:48 +08:00
|
|
|
})
|