56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import path from "path"
|
|
import tailwindcss from "@tailwindcss/vite"
|
|
import react from "@vitejs/plugin-react"
|
|
import {defineConfig, type Plugin} from "vite"
|
|
import {analyzer} from 'vite-bundle-analyzer'
|
|
|
|
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(), analyzer()],
|
|
optimizeDeps: {
|
|
entries: ["src/**/*.{ts,tsx}"],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
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,
|
|
},
|
|
},
|
|
},
|
|
})
|