Files
ps5upload/client/vite.config.ts
T
phantomptrandClaude Opus 5.5 c14782944d PS5Upload v5.35.0
Upload, install, convert and manage PS5 game packages over the network.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 04:31:13 -07:00

66 lines
2.5 KiB
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
export default defineConfig({
plugins: [react(), tailwindcss()],
clearScreen: false,
base: "./",
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
},
build: {
outDir: "dist",
emptyOutDir: true,
// Pin a conservative JS/CSS target. Tauri renders in a fixed WebView
// per platform, and the Android System WebView in particular can be
// an old Chromium. Without this, Vite ships its modern default
// (ES2020+ optional-chaining / nullish / logical-assignment that the
// v8/rolldown upgrade left un-lowered) and an older Android WebView
// renders the first screen, then crashes on `??=` / `?.` → the app
// "opens then terminates". safari13 (~ES2019) down-levels all of it
// and is safe for every WebView we ship to (Android Chromium,
// WebView2, WKWebView, WebKitGTK). Mirrors Tauri's recommended config.
target:
process.env.TAURI_ENV_PLATFORM === "windows" ? "chrome105" : "safari13",
chunkSizeWarningLimit: 900,
rollupOptions: {
// Silence rolldown's informational "[PLUGIN_TIMINGS] … significant time
// in @tailwindcss/vite:generate:build" note. Tailwind v4 scans the whole
// source tree to generate utilities, so its codegen is legitimately the
// slowest plugin — that's expected, not a problem to fix, and the note is
// just build noise. (rolldown input option, passed through by
// rolldown-vite; not in Vite's RollupOptions types yet.)
// @ts-expect-error checks is a rolldown passthrough not typed by Vite
checks: { pluginTimings: false },
output: {
manualChunks(id) {
if (!id.includes("node_modules")) return;
if (id.includes("react")) return "vendor-react";
return "vendor";
},
},
},
},
test: {
// Fail any test that reaches the network. See src/test-setup.ts for
// why: unmocked API wrappers silently hit a running dev engine.
setupFiles: ["./src/test-setup.ts"],
// Playwright owns real-browser journeys; Vitest must not import those
// files into its jsdom/node runner.
exclude: ["e2e/**", "**/node_modules/**", "**/.git/**"],
},
});