Skip to content
File

Blob: vite.config.ts

typescript38 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 { defineConfig } from "vite";
6 
7const persistStatePath = process.env.DAB_PERSIST_STATE_PATH;
8const wranglerConfigPath = process.env.DAB_WRANGLER_CONFIG_PATH;
9 
10export default defineConfig({
11 environments: {
12 dab: {
13 build: {
14 sourcemap: true,
15 },
16 },
17 },
18 plugins: [
19 react(),
20 babel({ presets: [reactCompilerPreset()] }),
21 tailwindcss(),
22 cloudflare({
23 ...(wranglerConfigPath ? { configPath: wranglerConfigPath } : {}),
24 ...(persistStatePath ? { persistState: { path: persistStatePath } } : {}),
25 remoteBindings: false,
26 }),
27 ],
28 resolve: {
29 alias: {
30 "@": new URL("./src", import.meta.url).pathname,
31 "@tests": new URL("./tests", import.meta.url).pathname,
32 },
33 },
34 server: {
35 cors: false,
36 },
37});