Files
Crystal/vite.config.ts
T
samyandClaude Opus 5.5 ce8129703f
Checks / web (push) Failing after 16s
Private ROM checks / private-rom (push) Failing after 17m47s
Make Crystal an installable web app with an offline shell (#39)
A manifest and icons rendered from icon.svg make the app installable.
The native build emits a service worker that precaches exactly the
built files and passes everything else to the network, so ROMs never
reach its cache. New versions wait for the player's Update, which saves
before reloading. Savegames offers installation, iPhone steps and
persistent storage, and a full disk gets its own save error.

Acceptance on physical iPhone and Android devices remains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:51:57 +02:00

32 lines
932 B
TypeScript

import { defineConfig } from "vite";
import { serviceWorkerPlugin } from "./scripts/service-worker.mjs";
export default defineConfig(({ mode }) => ({
publicDir: mode === "reference" ? "reference/public" : "public",
// Only the native player is installable; the reference stays a dev tool.
plugins: mode === "reference" ? [] : [serviceWorkerPlugin()],
server: {
host: "127.0.0.1",
// A user ROM may sit at the repository root. Never serve it or extracted
// assets and the private PRET checkout as static files.
fs: {
deny: [
"**/*.{gb,gbc,rom,sav}",
"**/*.crystal-save.json",
"**/.reference/**",
"**/artifacts/**",
".env",
".env.*",
"**/.git/**",
],
},
},
build:
mode === "reference"
? {
outDir: "dist-reference",
rollupOptions: { input: "reference.html" },
}
: { outDir: "dist" },
}));