Files
sharper.ly/apps/web/vite.config.ts
T
2026-09-11 02:46:56 +02:00

25 lines
1.1 KiB
TypeScript

import { reactRouter } from "@react-router/dev/vite";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [tailwindcss(), reactRouter()],
resolve: {
tsconfigPaths: true,
/* The workspace installs with `node-linker=hoisted` (see /.npmrc) and
apps/cms pins React 18 for the Strapi admin, so React 18 wins the hoist
to the root node_modules and React 19 ends up nested in more than one
place - once under apps/web, once under react-router. Two React 19
copies in one render is one copy too many: every SSR render threw
"Invalid hook call" until these two options were added. */
dedupe: ["react", "react-dom", "react-router"],
},
ssr: {
/* React Router is externalised by default, which means Node - not Vite -
resolves its `react` import at runtime, straight to the nested copy that
`dedupe` above cannot reach. Bundling it puts it back under Vite's
resolver, so the server build ends up with exactly one React. */
noExternal: ["react-router"],
},
});