You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SOURCEMAP_BROKEN warning from vite:css-post in the SSR build when sourcemaps are enabled #23809
vite build for an SSR/server environment with sourcemaps enabled prints:
[plugin vite:css-post] [SOURCEMAP_BROKEN] Sourcemap is likely to be incorrect: a plugin (vite:css-post) was used to transform files, but didn't generate a sourcemap for the transformation.
Cause I found
In packages/vite/src/node/plugins/css.ts, the vite:css-post transform for a server consumer returns a bare string:
It returns no map, so Rolldown reports that the transform has no sourcemap. The CSS module is replaced by an empty module, so there is nothing to map, but the check cannot tell.
Evidence
With build.sourcemap: false the warning disappears.
It appears only in the server environment; the client build is clean.
It happens with a plain import appCss from './styles.css?url' in the root route.
The sourcemaps are enabled by @cloudflare/vite-plugin (upload_source_maps: true), so turning them off is not an option for Workers stack traces.
Expected
No warning when the transform deliberately replaces the module. For example, return { code, map: { mappings: '' } }, as compileCSS already does elsewhere in the same file.
Workaround
build.rolldownOptions.checks.sourcemapBroken: false hides the warning, but it also hides real sourcemap problems from other plugins.
Reproduction
I do not have a standalone minimal reproduction yet. It reproduces in a TanStack Start project using @cloudflare/vite-plugin with viteEnvironment: { name: 'ssr' } and @tailwindcss/vite. I can add one if needed.
Hello @lucasvidela94. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs reproduction will be closed if they have no activity within 3 days.
I hit the same warning (vite 8.3.4, rolldown 1.2.14, TanStack Start 1.169.3 + @cloudflare/vite-plugin 1.64.0) and traced it to a different line than the one in the description. Here's a minimal reproduction with only Vite.
Cause
The line quoted above (css.ts L621, if (this.environment.config.consumer === 'server') return modulesCode || 'export {}') is inside if (config.command === 'serve'), so it doesn't run in vite build. The build path of that transform already returns map: { mappings: '' }.
The warning comes from renderChunk in vite:css-post. That hook rewrites the ?url CSS placeholder in the chunk with MagicString, then decides whether to return a map from the plugin's captured config (css.ts L991 at v8.3.4, L994 on main):
With builder.sharedPlugins or builder.sharedConfigBuild, the plugin is created once from the top-level config. An environment that enables sourcemaps only for itself therefore gets { code } with no map, and Rolldown reports SOURCEMAP_BROKEN. TanStack Start sets builder.sharedPlugins: true, and @cloudflare/vite-plugin turns sourcemaps on for the Worker environment only (upload_source_maps). That's why this combination hits it.
Reproduction (Vite only)
style.css is any CSS, and index.html loads an empty main.js.
true, with environments.client.build.sourcemap: false
no
The last row changes only the value that check reads. The server map is still emitted (server.mjs.map), and the warning is gone.
Suggested fix
- if (config.build.sourcemap) {+ if (this.environment.config.build.sourcemap) {
The same hook already reads this.environment.config.build.cssCodeSplit (L899). I haven't built Vite with this patch; the last row above is what isolates the check.
Narrower workaround
checks.sourcemapBroken: false hides every plugin's broken map. Filtering only this one keeps the rest:
Activity
github-actions commentedon Oct 18, 2026
Hello @lucasvidela94. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with
needs reproductionwill be closed if they have no activity within 3 days.chore: upgrade every dependency to its latest stable release
tkowalczyk commentedon Oct 20, 2026
I hit the same warning (vite 8.3.4, rolldown 1.2.14, TanStack Start 1.169.3 +
@cloudflare/vite-plugin1.64.0) and traced it to a different line than the one in the description. Here's a minimal reproduction with only Vite.Cause
The line quoted above (
css.tsL621,if (this.environment.config.consumer === 'server') return modulesCode || 'export {}') is insideif (config.command === 'serve'), so it doesn't run invite build. The build path of that transform already returnsmap: { mappings: '' }.The warning comes from
renderChunkinvite:css-post. That hook rewrites the?urlCSS placeholder in the chunk with MagicString, then decides whether to return a map from the plugin's captured config (css.tsL991 at v8.3.4, L994 onmain):With
builder.sharedPluginsorbuilder.sharedConfigBuild, the plugin is created once from the top-level config. An environment that enables sourcemaps only for itself therefore gets{ code }with no map, and Rolldown reportsSOURCEMAP_BROKEN. TanStack Start setsbuilder.sharedPlugins: true, and@cloudflare/vite-pluginturns sourcemaps on for the Worker environment only (upload_source_maps). That's why this combination hits it.Reproduction (Vite only)
style.cssis any CSS, andindex.htmlloads an emptymain.js.vite build --app:builderbuild.sourcemapSOURCEMAP_BROKEN{}{ sharedPlugins: true }{ sharedConfigBuild: true }{ sharedPlugins: true }true, withenvironments.client.build.sourcemap: falseThe last row changes only the value that check reads. The server map is still emitted (
server.mjs.map), and the warning is gone.Suggested fix
The same hook already reads
this.environment.config.build.cssCodeSplit(L899). I haven't built Vite with this patch; the last row above is what isolates the check.Narrower workaround
checks.sourcemapBroken: falsehides every plugin's broken map. Filtering only this one keeps the rest:Silence two upstream build warnings narrowly