Files
SLA_SEPARACAO/vite.config.ts
T
joao.herculano 361308f127 desvincula o app do Lovable e corrige preset de build para Node
Remove .lovable/, AGENTS.md (banner de sync), bun.lock/bunfig.toml
(não usados, o build é via npm), lovable-error-reporting.ts, a
dependência @lovable.dev/vite-tanstack-config e o branding Lovable nas
metatags. vite.config.ts passa a configurar os plugins do TanStack
Start/Tailwind/nitro diretamente, sem o wrapper deles.

Nisso, corrige um bug crítico: o preset do nitro estava em
cloudflare-module (gera um Cloudflare Worker), mas o Dockerfile roda
o build direto com `node`. O container subiria sem escutar em porta
nenhuma e o /healthz falharia sempre. Preset trocado para node-server.
2026-08-06 12:33:19 -03:00

41 lines
1.2 KiB
TypeScript

import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";
import tsConfigPaths from "vite-tsconfig-paths";
import react from "@vitejs/plugin-react";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import { nitro } from "nitro/vite";
export default defineConfig(({ command }) => ({
css: { transformer: "lightningcss" },
resolve: {
alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) },
dedupe: [
"react",
"react-dom",
"react/jsx-runtime",
"react/jsx-dev-runtime",
"@tanstack/react-query",
"@tanstack/query-core",
],
},
optimizeDeps: {
include: ["react", "react-dom", "react-dom/client", "react/jsx-runtime", "react/jsx-dev-runtime"],
},
server: {
host: "::",
port: 8080,
},
plugins: [
tailwindcss(),
tsConfigPaths({ projects: ["./tsconfig.json"] }),
tanstackStart({
server: { entry: "server" },
}),
// Node HTTP server output, not a Cloudflare Worker: the Dockerfile runs
// this with plain `node`, so the build must target node-server.
...(command === "build" ? [nitro({ preset: "node-server" })] : []),
react(),
],
}));