Skip to content

feat: Rolldown/Vite 8 SSR build support#8508

Closed
juslintek wants to merge 2 commits intoQwikDev:build/v2from
juslintek:rolldown-fix
Closed

feat: Rolldown/Vite 8 SSR build support#8508
juslintek wants to merge 2 commits intoQwikDev:build/v2from
juslintek:rolldown-fix

Conversation

@juslintek
Copy link
Copy Markdown

@juslintek juslintek commented Mar 31, 2026

Summary

Enables SSR builds with Vite 8 + Rolldown by cherry-picking and rebasing the core changes from #8379 onto current build/v2.

  • Detect Rolldown via this.meta.rolldownVersion in vite plugin
  • Use codeSplitting instead of manualChunks for Rolldown (manualChunks is deprecated in Rolldown)
  • Maintain clientSegments Map as workaround for missing module.meta ([Bug]: codeSplitting groups name function context is missing meta information rolldown/rolldown#8924)
  • Preserve raw capture expressions for .w() calls (Rolldown inlines capture variables before the optimizer runs, turning Idents into complex expressions)
  • Remove clearTransitiveDeps from bundle-graph (needed for Rolldown compatibility)
  • Add rolldownOptions input detection alongside rollupOptions

Context

PR #8379 by @maiieul contains the full Rolldown support work but has accumulated merge conflicts with build/v2. This PR extracts and applies the essential changes cleanly onto current build/v2, covering:

  • packages/qwik-vite/src/plugins/plugin.ts - Rolldown detection, clientSegments Map, codeSplitting plugin property
  • packages/qwik-vite/src/plugins/rollup.ts - normalizeRolldownOutputOptions(), codeSplitting groups
  • packages/qwik-vite/src/plugins/vite.ts - rolldownOptions key detection, dual build options
  • packages/qwik-vite/src/plugins/bundle-graph.ts - Remove clearTransitiveDeps, remove depsCount check
  • packages/qwik-vite/src/manifest.ts - Rolldown output handling
  • packages/optimizer/core/src/transform.rs - raw_capture_exprs field for non-Ident capture preservation

Testing

Tested against a production Qwik 2 app with:

  • @qwik.dev/core: 2.0.0-beta.30
  • Vite: 8.0.3
  • Rolldown: 1.0.0-rc.12

Results:

  • vite build (client): passes
  • vite build --ssr src/entry.preview.tsx: passes (was failing with Qwik input "src/entry.preview.tsx" not found)
  • vite preview: serves correctly
  • 171 Playwright E2E tests: pass

Related

Cherry-picked from QwikDev/qwik PR QwikDev#8379 (rolldown-vite-support branch).
Applied onto current build/v2.

Key changes:
- Detect Rolldown via this.meta.rolldownVersion in vite plugin
- Use codeSplitting instead of manualChunks for Rolldown
- Maintain clientSegments Map as workaround for missing module.meta
- Preserve raw capture expressions for .w() calls (Rolldown inlines captures)
- Remove clearTransitiveDeps from bundle-graph (needed for Rolldown)
- Add rolldownOptions input detection alongside rollupOptions

Tested against Utilio (Qwik 2 + Vite 8.0.3 + Rolldown 1.0.0-rc.12):
- vite build (client): passes
- vite build --ssr src/entry.preview.tsx: passes (was broken before)
- vite preview: serves correctly
@juslintek juslintek requested a review from a team as a code owner March 31, 2026 13:50
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 92d8524

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 089b14b0b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +406 to +408
sys.path.isAbsolute(input) || input.startsWith('@') || input.startsWith('\0')
? input
: normalizePath(sys.path.resolve(opts.rootDir, input));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve virtual input IDs during source validation

Do not rewrite every non-absolute input into rootDir-relative paths before resolving, because this breaks virtual/bare entry IDs that Vite plugins are expected to resolve (for example virtual:* inputs, which this plugin explicitly supports in buildStart). With the new normalization, resolver() receives /.../virtual:entry instead of virtual:entry, so valid plugin-provided SSR/client inputs now fail with Qwik input "..." not found. in validateSource.

Useful? React with 👍 / 👎.

@thejackshelton
Copy link
Copy Markdown
Member

Hey @juslintek! What all is different from Maieul's PR?

@maiieul
Copy link
Copy Markdown
Member

maiieul commented Mar 31, 2026

Thanks @juslintek but I'm still testing my PR (certain preloading behavior is not tested yet) and we are waiting for the other changes to be merged before merging this one to make a clean release. You can install my PR with the pkg.pr.new if you need to use it in the meantime. I try to rebase often.

@maiieul maiieul closed this Mar 31, 2026
@juslintek
Copy link
Copy Markdown
Author

juslintek commented Mar 31, 2026

Hey @juslintek! What all is different from Maieul's PR?

Hey @thejackshelton! The changes are the same as @maiieul’s #8379 — I cherry-picked the core Rolldown/Vite 8 fixes and rebased them cleanly onto current build/v2. Maieul’s PR had accumulated merge conflicts with the branch, and I needed a working build for my project which runs Vite 8 + Rolldown in production.

Given @maiieul’s comment that they’re still testing preloading behavior and waiting for other changes to land first, happy to close this in favor of #8379 once it’s rebased. Just wanted to make the clean rebase available in case it’s useful.

@maiieul’s PR is the canonical source for this work — I’ve switched to using the pkg.pr.new build (https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8379) as suggested, which works great. Thanks for the pointer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants