mirror of
https://github.com/delibae/claude-prism.git
synced 2026-12-06 00:27:25 +00:00
On macOS 12 (Monterey), the app launches but no main window appears. The root cause is WebKit bug #242740: Safari 15's WKWebView has a race condition with top-level await in ES modules, causing silent JS failure that prevents `getCurrentWindow().show()` from ever being called. Three complementary fixes: 1. Change Vite build target from `esnext` to `safari14` (Tauri recommended) and add `vite-plugin-top-level-await` to transform TLA into compatible Promise chains, avoiding the WebKit bug entirely. 2. Replace top-level `await import("./App")` in main.tsx with a `.then()` chain, removing TLA dependency at the source level. 3. Add a Rust-side 8-second timeout safety net in `setup()` that force-shows the main window if the frontend JS fails to do so, preventing permanently hidden windows regardless of the failure cause. Closes #95 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
969 B
TypeScript
44 lines
969 B
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import topLevelAwait from "vite-plugin-top-level-await";
|
|
import path from "node:path";
|
|
|
|
const host = process.env.TAURI_DEV_HOST;
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), topLevelAwait()],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "src"),
|
|
},
|
|
},
|
|
worker: {
|
|
format: "es",
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ["mupdf"],
|
|
},
|
|
clearScreen: false,
|
|
server: {
|
|
port: 1420,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host
|
|
? {
|
|
protocol: "ws",
|
|
host,
|
|
port: 1421,
|
|
}
|
|
: undefined,
|
|
watch: {
|
|
ignored: ["**/src-tauri/**"],
|
|
},
|
|
},
|
|
envPrefix: ["VITE_", "TAURI_"],
|
|
build: {
|
|
target:
|
|
process.env.TAURI_ENV_PLATFORM === "windows" ? "chrome105" : "safari14",
|
|
minify: !process.env.TAURI_ENV_DEBUG ? "esbuild" : false,
|
|
sourcemap: !!process.env.TAURI_ENV_DEBUG,
|
|
},
|
|
});
|