Vitron-Front/vite.config.ts
2026-04-29 01:44:16 +03:30

78 lines
1.8 KiB
TypeScript

import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
declare module "@remix-run/node" {
interface Future {
v3_singleFetch: true;
}
}
export default defineConfig({
plugins: [
remix({
future: {
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
v3_singleFetch: true,
v3_lazyRouteDiscovery: true,
},
}),
tsconfigPaths(),
],
server: {
host: "0.0.0.0",
port: 5173,
allowedHosts: [
"localhost",
"dev.vitrown.com",
"prod.vitrown.com",
"vitrown.com",
".vitrown.com"
],
},
build: {
target: "esnext",
// Fast builds for development
minify: process.env.NODE_ENV === "production" ? "terser" : false,
sourcemap: process.env.NODE_ENV === "development",
terserOptions: process.env.NODE_ENV === "production" ? {
compress: {
drop_console: true,
drop_debugger: true,
passes: 1, // Reduced from 2
},
format: {
comments: false,
},
} : undefined,
rollupOptions: {
output: {
// Only chunk in production
manualChunks: process.env.NODE_ENV === "production" ? (id) => {
if (id.includes("node_modules")) {
if (id.includes("lucide-react")) return "vendor-icons";
// Don't separate radix-ui to avoid React context issues
return "vendor";
}
} : undefined,
},
},
chunkSizeWarningLimit: 2000, // Increased to reduce warnings
},
optimizeDeps: {
include: [
"react",
"react-dom",
"@tanstack/react-query",
"react-i18next",
"i18next",
"moment-jalaali"
],
exclude: ["@remix-run/dev"],
},
resolve: {
dedupe: ["react", "react-dom"],
},
});