Vite · VITE0018
Avoid browser globals in Vite SSR entries
Flags browser global in SSR entry in Vite SSR code before it leaks into runtime behavior.
Run this rule
pnpm vite-doctor . --framework vite --rules vite/ssr/no-browser-global-in-ssr-entry
Why it matters
Server-rendered markup must match the first client render. Browser-only state, time, randomness, or hash-sensitive URLs can create hydration mismatches.
Recommended fix
Remove browser global in SSR entry, or move it to the Vite runtime/API that owns that behavior.
Useful links
Example
Avoid browser globals in SSR entry
Before
export function render() {
return window.location.href
}
After
export function render(url: string) {
return url
}