This commit is contained in:
2026-08-10 02:04:45 +02:00
parent 39cb848f67
commit 593edf35fe
10 changed files with 394 additions and 33 deletions
+22
View File
@@ -4,13 +4,35 @@ import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
import { DEV_API_PROXY_TARGET, DEV_WEB_PORT } from "../../scripts/dev-ports.mjs";
import { detectHostProfile } from "../../scripts/lowmem-env.mjs";
const monorepoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const profile = detectHostProfile();
/** Env wins; otherwise follow auto RAM/CPU tier. */
const lowMem =
process.env.BUILD_LOW_MEM != null && process.env.BUILD_LOW_MEM !== ""
? process.env.BUILD_LOW_MEM !== "0"
: profile.lowMem;
export default defineConfig({
// Load PUBLIC_* from monorepo-root .env (same file as the Go API).
envDir: monorepoRoot,
plugins: [tailwindcss(), sveltekit()],
build: {
// Gzip size reporting double-reads output and spikes peak RSS on tiny hosts.
reportCompressedSize: !lowMem,
// Production maps are opt-in; maps roughly double transform memory.
sourcemap: process.env.BUILD_SOURCEMAP === "1",
// Smaller inlined assets → less heap during transform on 4GB boxes.
assetsInlineLimit: lowMem ? 1024 : 4096,
rolldownOptions: {
checks: {
// Informative only; sveltekit-guard resolveId dominates wall time (see Rolldown docs).
pluginTimings: process.env.BUILD_PLUGIN_TIMINGS === "1"
}
}
},
server: {
// true → all interfaces (IPv4 + IPv6). Default localhost is ::1-only on Windows,
// which breaks 127.0.0.1 probes and some browser Happy Eyeballs paths.