File
Blob: vite.config.ts
| 1 | import { cloudflare } from "@cloudflare/vite-plugin"; |
| 2 | import babel from "@rolldown/plugin-babel"; |
| 3 | import tailwindcss from "@tailwindcss/vite"; |
| 4 | import react, { reactCompilerPreset } from "@vitejs/plugin-react"; |
| 5 | import { resolve } from "node:path"; |
| 6 | import { defineConfig } from "vite"; |
| 7 | |
| 8 | const persistStatePath = process.env.TESSERA_PERSIST_STATE_PATH; |
| 9 | |
| 10 | export default defineConfig({ |
| 11 | plugins: [ |
| 12 | react(), |
| 13 | babel({ presets: [reactCompilerPreset()] }), |
| 14 | tailwindcss(), |
| 15 | cloudflare( |
| 16 | persistStatePath |
| 17 | ? { |
| 18 | persistState: { |
| 19 | path: persistStatePath, |
| 20 | }, |
| 21 | } |
| 22 | : undefined, |
| 23 | ), |
| 24 | ], |
| 25 | resolve: { |
| 26 | alias: { |
| 27 | "@": resolve(import.meta.dirname, "src"), |
| 28 | }, |
| 29 | }, |
| 30 | build: { |
| 31 | // Never inline font files. CSP locks `font-src` to `'self'`, which would |
| 32 | // reject `data:` URIs. Small SVGs/icons under the default 4 KB threshold |
| 33 | // continue to inline normally — `undefined` falls back to that default. |
| 34 | assetsInlineLimit: (filePath) => { |
| 35 | if (/\.(woff2?|ttf|otf|eot)$/i.test(filePath)) { |
| 36 | return false; |
| 37 | } |
| 38 | return undefined; |
| 39 | }, |
| 40 | }, |
| 41 | }); |