The best way to control Claude Code, Codex and more from any computer or phone

main
ts 31 lines 1.06 KB
Raw
1 import path from "node:path";
2 import react from "@vitejs/plugin-react";
3 import { defineConfig, type Plugin } from "vite";
4
5 const captureDir = path.resolve(import.meta.dirname, "..", "out", "capture");
6
7 /** Tell the page when intro.json or a scene.json is rebuilt, so it reloads the data in place. */
8 const captureData = (): Plugin => ({
9 name: "prezzy-capture-data",
10 configureServer(server) {
11 server.watcher.add(captureDir);
12 server.watcher.on("change", (file) => {
13 if (
14 file.startsWith(captureDir) &&
15 file.endsWith(".json") &&
16 !file.endsWith("diagnostics.json")
17 ) {
18 server.ws.send({ type: "custom", event: "prezzy:data", data: { file } });
19 }
20 });
21 },
22 });
23
24 export default defineConfig({
25 root: import.meta.dirname,
26 // Captures (scene.json, terminal clips, screenshots, intro.json) are served
27 // at the root, where Remotion's staticFile() looks for them.
28 publicDir: captureDir,
29 plugins: [react(), captureData()],
30 server: { port: 5199, fs: { allow: [path.resolve(import.meta.dirname, "..", "..", "..")] } },
31 });