Browser reference stack for PSX-era third-person adventure: fixed cameras, inventory puzzles, Box3D physics, host-authoritative P2P co-op, and a modular character harness. Ships the Ashgrove Precinct Level 1 investigation demo with a full cast and nine linked rooms.
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import solid from "vite-plugin-solid";
|
|
|
|
/**
|
|
* box3d-wasm ships two builds and picks one at runtime. The threaded "deluxe"
|
|
* build needs SharedArrayBuffer, which browsers only expose on a cross-origin
|
|
* isolated page — hence the COOP/COEP headers below. Without them we silently
|
|
* fall back to the single-threaded build, which still works but leaves the
|
|
* multithreaded solver on the table.
|
|
*/
|
|
const crossOriginIsolation = {
|
|
"Cross-Origin-Opener-Policy": "same-origin",
|
|
"Cross-Origin-Embedder-Policy": "require-corp",
|
|
};
|
|
|
|
export default defineConfig({
|
|
plugins: [solid()],
|
|
server: {
|
|
headers: crossOriginIsolation,
|
|
// Generated characters live in the workspace-root `assets/` directory, which
|
|
// is outside the client package. One source of truth beats copying GLBs
|
|
// into `public/` on every harness run.
|
|
fs: { allow: [".."] },
|
|
},
|
|
preview: { headers: crossOriginIsolation },
|
|
// The threaded build's pthread worker uses top-level await, which cannot be
|
|
// expressed in Vite's default `iife` worker format.
|
|
worker: { format: "es" },
|
|
// Emscripten glue resolves its .wasm via `new URL(..., import.meta.url)`.
|
|
// Pre-bundling rewrites that URL and breaks the fetch, so keep it external.
|
|
optimizeDeps: { exclude: ["box3d-wasm"] },
|
|
build: { target: "es2022" },
|
|
});
|