cloudflare / cloudflare/vinext
Build failure: CSS file missing in SSR bundle (`style.css` not emitted)
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 406
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 122
Description
> *This issue was created by an agent analysing CI failures from the [Next.js Deploy Suite](https://github.com/cloudflare/vinext/actions/runs/26163751905) (vinext `main` vs Next.js `v16.2.6`, 2026-05-20).*
## Problem
The SSR bundle's `index.js` contains an `import './style.css'` statement, but the CSS file is not emitted to `dist/server/ssr/`. The build succeeds, but the production server crashes during prerendering when Node.js tries to resolve the `.css` import.
```
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
'/tmp/.../dist/server/ssr/style.css'
imported from /tmp/.../dist/server/ssr/index.js
```
CSS imports in SSR builds should either be stripped (since CSS is injected client-side) or the CSS file should be emitted alongside the SSR bundle.
## Estimated Impact
~5 test failures (1 runtime crash, 5 failed assertions).
## Affected Test Suites
- `test/e2e/react-version/react-version.test.ts` (5 failures)
## Recommendation
1. **Reproduce first in vinext's own test suite.** Add a test that imports CSS in a component and verify the SSR build doesn't crash during prerendering. Confirm it fails.
2. **Strip or emit CSS in SSR builds.** Either configure the SSR build to strip CSS imports (replace with empty modules) or ensure CSS files are properly emitted to the SSR output directory. Study how `@vitejs/plugin-rsc` and Vite handle CSS in SSR environments.
3. **Check the Vite SSR build configuration.** The `build.rolldownOptions` for the SSR environment may need `css` handling configuration.
Contributor guide
Research direction
Reproduce the failure in test/e2e/react-version/react-version.test.ts by tracing the SSR build output under dist/server/ssr/. Then inspect the Vite SSR configuration, especially build.rolldownOptions, and compare the CSS handling used by @vitejs/plugin-rsc and Vite. Done means the SSR prerender no longer crashes because of the style.css import and the affected test assertions pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100