Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
41 lines (37 loc) · 1.41 KB
/
Copy pathvite.config.ts
File metadata and controls
41 lines (37 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// @lovable.dev/vite-tanstack-config already includes the following — do NOT add them manually
// or the app will break with duplicate plugins:
// - tanstackStart, viteReact, tailwindcss, tsConfigPaths, cloudflare (build-only),
// componentTagger (dev-only), VITE_* env injection, @ path alias, React/TanStack dedupe,
// error logger plugins, and sandbox detection (port/host/strictPort).
// You can pass additional config via defineConfig({ vite: { ... } }) if needed.
import { defineConfig } from "@lovable.dev/vite-tanstack-config";
import { copyFileSync, rmSync, symlinkSync } from "node:fs";
import { join, resolve } from "node:path";
import type { PluginOption } from "vite";
function permanentTemporarySolution(): PluginOption {
return {
name: "permanent-temporary-solution",
apply: "build",
writeBundle() {
const dir = resolve(__dirname, "dist/server");
const index = join(dir, "index.js");
const server = join(dir, "server.js");
try {
copyFileSync(server, index);
} catch {
/* empty */
}
},
};
}
// Redirect TanStack Start's bundled server entry to src/server.ts (our SSR error wrapper).
// @cloudflare/vite-plugin builds from this — wrangler.jsonc main alone is insufficient.
export default defineConfig({
plugins: [permanentTemporarySolution()],
tanstackStart: {
server: { entry: "server" },
},
vite: {
base: "/",
},
});