Skip to content
File

Blob: vite.config.ts

typescript42 lines
1import { cloudflare } from "@cloudflare/vite-plugin";
2import babel from "@rolldown/plugin-babel";
3import tailwindcss from "@tailwindcss/vite";
4import react, { reactCompilerPreset } from "@vitejs/plugin-react";
5import { resolve } from "node:path";
6import { defineConfig } from "vite";
7 
8const persistStatePath = process.env.TESSERA_PERSIST_STATE_PATH;
9 
10export 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});