feat: Rolldown/Vite 8 SSR build support#8508
feat: Rolldown/Vite 8 SSR build support#8508juslintek wants to merge 2 commits intoQwikDev:build/v2from
Conversation
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
🦋 Changeset detectedLatest 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 |
There was a problem hiding this comment.
💡 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".
| sys.path.isAbsolute(input) || input.startsWith('@') || input.startsWith('\0') | ||
| ? input | ||
| : normalizePath(sys.path.resolve(opts.rootDir, input)); |
There was a problem hiding this comment.
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 👍 / 👎.
|
Hey @juslintek! What all is different from Maieul's PR? |
|
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. |
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! |
Summary
Enables SSR builds with Vite 8 + Rolldown by cherry-picking and rebasing the core changes from #8379 onto current
build/v2.this.meta.rolldownVersionin vite plugincodeSplittinginstead ofmanualChunksfor Rolldown (manualChunksis deprecated in Rolldown)clientSegmentsMap as workaround for missingmodule.meta([Bug]: codeSplitting groups name function context is missing meta information rolldown/rolldown#8924).w()calls (Rolldown inlines capture variables before the optimizer runs, turning Idents into complex expressions)clearTransitiveDepsfrom bundle-graph (needed for Rolldown compatibility)rolldownOptionsinput detection alongsiderollupOptionsContext
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 currentbuild/v2, covering:packages/qwik-vite/src/plugins/plugin.ts- Rolldown detection, clientSegments Map, codeSplitting plugin propertypackages/qwik-vite/src/plugins/rollup.ts-normalizeRolldownOutputOptions(),codeSplittinggroupspackages/qwik-vite/src/plugins/vite.ts-rolldownOptionskey detection, dual build optionspackages/qwik-vite/src/plugins/bundle-graph.ts- RemoveclearTransitiveDeps, removedepsCountcheckpackages/qwik-vite/src/manifest.ts- Rolldown output handlingpackages/optimizer/core/src/transform.rs-raw_capture_exprsfield for non-Ident capture preservationTesting
Tested against a production Qwik 2 app with:
Results:
vite build(client): passesvite build --ssr src/entry.preview.tsx: passes (was failing withQwik input "src/entry.preview.tsx" not found)vite preview: serves correctlyRelated
module.metanot supported)