anvilsign in

collin/strudel-claude

1import { defineConfig } from 'vite';
2
3// Frontend dev server. All /api/* calls are proxied to the Express backend
4// (server/index.js) so the browser never sees the Anthropic API key.
5// Where the Express backend is listening. Override to run a second instance
6// alongside the usual one (API_PORT=8899 vite --port 5174).
7const API = `localhost:${process.env.API_PORT || 8787}`;
8
9export default defineConfig({
10 build: {
11 // The Strudel libraries are inherently large (soundfonts, codemirror, the
12 // pattern engine) and are all needed on first paint, so code-splitting them
13 // buys nothing. Raise the bar past the real bundle size instead.
14 chunkSizeWarningLimit: 2000,
15 rolldownOptions: {
16 onwarn(warning, defaultHandler) {
17 // @strudel/soundfonts parses sf2 metadata with a direct eval(). Nothing
18 // we can do from here, and it doesn't break the build.
19 if (warning.code === 'EVAL' && /node_modules[/\\]@strudel[/\\]/.test(warning.id ?? '')) return;
20 defaultHandler(warning);
21 },
22 },
23 },
24 server: {
25 port: 5173,
26 proxy: {
27 '/api': `http://${API}`,
28 // The timing broadcast hub. `ws: true` so the upgrade request is proxied
29 // rather than answered by Vite's own HMR socket.
30 '/ws': { target: `ws://${API}`, ws: true },
31 // Serve the terminal client's source through the dev server too, so the
32 // curl-it-and-run instructions work on :5173 as well as the API port.
33 '/tui.py': `http://${API}`,
34 },
35 },
36});