Back to all fixes
CuratedTypeScriptVite 8local
inlineConst inlines null from `export var foo = null`, breaking SvelteKit SSR with "Cannot set properties of null"
Problem
A minimal SvelteKit app built with rolldown-vite returns HTTP 500 on preview, with `TypeError: Cannot set properties of null (setting 'c')` thrown deep in the generated server chunk (`server.js`). Root cause: `build.optimization.inlineConst` inlines the initial `null` value of a `export var foo = null` binding even though the variable is reassigned later, so later code that expects the mutated object instead sees `null`.
Solution
typescript
Fixed in rolldown-vite v7.1.6 — upgrade. v7.1.8 additionally enables `optimization.inlineConst: { mode: 'smart' }` by default, which correctly handles this esm-env-style reassignment pattern. If you're stuck on an older pinned version, disable the optimization entirely via `build.rolldownOptions.optimization.inlineConst: false` as a stopgap. Note vite-plugin-svelte 6.2.0+ re-enables `inlineConst` automatically once you're past the affected versions, so don't leave it force-disabled after upgrading.