-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
30 lines (29 loc) · 882 Bytes
/
Copy pathvite.config.ts
File metadata and controls
30 lines (29 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { cloudflare } from "@cloudflare/vite-plugin";
import { reactRouter } from "@react-router/dev/vite";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
plugins: [
cloudflare({
viteEnvironment: { name: "ssr" },
}),
tailwindcss(),
reactRouter(),
tsconfigPaths(),
{
// https://github.com/cloudflare/workers-sdk/issues/8909#issuecomment-3401112596
name: "cloudflare-vite-plugin-fix",
configEnvironment(name, config) {
const isDevelopment =
process.env.npm_lifecycle_script?.endsWith("react-router dev");
if (name === "ssr" && !isDevelopment) {
delete config.dev;
}
},
},
],
ssr: {
noExternal: [/^sanity($|\/)/, /^@sanity\//, "styled-components"],
},
});