import { cloudflare } from "@cloudflare/vite-plugin"; import babel from "@rolldown/plugin-babel"; import tailwindcss from "@tailwindcss/vite"; import react, { reactCompilerPreset } from "@vitejs/plugin-react"; import { resolve } from "node:path"; import { defineConfig } from "vite"; const persistStatePath = process.env.TESSERA_PERSIST_STATE_PATH; export default defineConfig({ plugins: [ react(), babel({ presets: [reactCompilerPreset()] }), tailwindcss(), cloudflare( persistStatePath ? { persistState: { path: persistStatePath, }, } : undefined, ), ], resolve: { alias: { "@": resolve(import.meta.dirname, "src"), }, }, build: { // Never inline font files. CSP locks `font-src` to `'self'`, which would // reject `data:` URIs. Small SVGs/icons under the default 4 KB threshold // continue to inline normally — `undefined` falls back to that default. assetsInlineLimit: (filePath) => { if (/\.(woff2?|ttf|otf|eot)$/i.test(filePath)) { return false; } return undefined; }, }, });