gitdataai/vite.config.ts

51 lines
1.2 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/**"],
},
proxy: {
"/api": {
target: "http://localhost:8080",
changeOrigin: true,
},
"/ws": {
target: "ws://localhost:8080",
changeOrigin: true,
ws: true,
},
},
},
})