gitdataai/vite.config.ts
ZhenYi 110945e438 chore: update Vite config and add channel animations CSS
Remove dev proxy, add channel animation styles for message
display effects.
2026-05-14 23:13:52 +08:00

56 lines
1.3 KiB
TypeScript

import path from "path"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import {defineConfig, type Plugin} from "vite"
function tailwindEscapeFix(): Plugin {
return {
name: "tailwind-escape-fix",
enforce: "pre",
async transform(code, id) {
if (id.endsWith(".css")) {
return code.replace(/(\d)::(\d)(px|rem|em|%|vh|vw|ms|s)/g, "$1.$2$3")
}
},
}
}
export default defineConfig({
plugins: [tailwindcss(), tailwindEscapeFix(), react()],
optimizeDeps: {
entries: ["src/**/*.{ts,tsx}"],
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
dedupe: ["react", "react-dom"],
},
server: {
host: true,
port: 5080,
fs: {
deny: ["**/target/**"],
},
watch: {
ignored: ["**/libs/**", "**/target/**"],
},
hmr: {
host: "localhost",
port: 5080,
protocol: "ws",
},
proxy: {
"/api": {
target: "http://localhost:8080",
changeOrigin: true,
},
"/ws": {
target: "ws://localhost:8080",
changeOrigin: true,
ws: true,
},
},
},
})