Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat(rspack): use rsbuild dev server in middleware mode - #35575

#35575
Merged
danielroe merged 3 commits into
mainnuxt/nuxt:mainfrom
feat/rsbuild-dev-servernuxt/nuxt:feat/rsbuild-dev-serverCopy head branch name to clipboard
Jul 15, 2026
Merged

feat(rspack): use rsbuild dev server in middleware mode#35575
danielroe merged 3 commits into
mainnuxt/nuxt:mainfrom
feat/rsbuild-dev-servernuxt/nuxt:feat/rsbuild-dev-serverCopy head branch name to clipboard

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

follow-on from #35489

📚 Description

this migrates us to use the rsbuild dev server rather than webpack-dev-middleware and webpack-hot-middleware

@github-actions github-actions Bot added 5.x ✨ enhancement New feature or improvement to existing functionality labels Jul 14, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35575

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35575

nuxt

npm i https://pkg.pr.new/nuxt@35575

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@35575

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35575

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@35575

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@35575

commit: d5b4376

@coderabbitai

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/webpack/src/configs/client.ts`:
- Around line 79-86: Restrict the early return in the HMR setup after adding
HotModuleReplacementPlugin to cases where builder is 'rspack' and createRsbuild
is truthy, matching the routing condition in webpack.ts. Allow the
webpack-hot-middleware/client injection to continue for rspack builds using the
classic middleware fallback.

In `@packages/webpack/src/webpack.ts`:
- Around line 224-247: Update rsbuildToH3Handler so its middleware callback
accepts the optional error and rejects the surrounding Promise when next(err) is
provided; retain the existing done/resolve behavior for error-free next calls
and response finish/close events.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 93d29300-0f37-47a3-abb9-4c534a7f7c03

📥 Commits

Reviewing files that changed from the base of the PR and between 783f1ae and 8d8ea8c.

⛔ Files ignored due to path filters (2)
  • packages/rspack/package.json is excluded by !**/package.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (3)
  • packages/nitro-server/src/legacy.ts
  • packages/webpack/src/configs/client.ts
  • packages/webpack/src/webpack.ts

Comment thread packages/webpack/src/configs/client.ts
Comment thread packages/webpack/src/webpack.ts
@codspeed-hq

codspeed-hq Bot commented Jul 14, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.8%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 20 untouched benchmarks
⏩ 3 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
loadNuxt in the basic test fixture (dev) 370.3 ms 322.5 ms +14.8%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/rsbuild-dev-server (d5b4376) with main (d597a4e)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/webpack/src/webpack.ts (1)

212-218: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Ensure Rsbuild's dev server lifecycle completes even without a listener.

Rsbuild's devServer.afterListen() triggers the onAfterStartDevServer lifecycle hooks. It should be called unconditionally to ensure any plugins relying on these hooks execute properly, even if HMR is disabled due to a missing listener.

♻️ Proposed refactor
   const listener = nuxt._devServerListener
   if (listener) {
     devServer.connectWebSocket({ server: listener })
-    await devServer.afterListen()
   } else {
     logger.warn('Could not find the Nuxt dev server to attach Rspack HMR to; hot module replacement will be disabled.')
   }
+
+  await devServer.afterListen()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/webpack/src/webpack.ts` around lines 212 - 218, Update the
dev-server setup around the listener check so devServer.afterListen() is called
unconditionally after the optional devServer.connectWebSocket({ server: listener
}) call. Keep the existing warning and HMR-disabled behavior when listener is
absent, while ensuring the onAfterStartDevServer lifecycle hooks always execute.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/webpack/src/webpack.ts`:
- Around line 212-218: Update the dev-server setup around the listener check so
devServer.afterListen() is called unconditionally after the optional
devServer.connectWebSocket({ server: listener }) call. Keep the existing warning
and HMR-disabled behavior when listener is absent, while ensuring the
onAfterStartDevServer lifecycle hooks always execute.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 97016909-17ef-417f-bc64-8590442b5468

📥 Commits

Reviewing files that changed from the base of the PR and between 5ac3549 and 611afb0.

📒 Files selected for processing (4)
  • packages/nuxt/src/core/nuxt.ts
  • packages/schema/src/types/nuxt.ts
  • packages/vite/src/plugins/dev-server.ts
  • packages/webpack/src/webpack.ts

@danielroe
danielroe force-pushed the feat/rsbuild-dev-server branch from 611afb0 to d5b4376 Compare July 15, 2026 10:05
@danielroe
danielroe merged commit a5c1086 into main Jul 15, 2026
65 of 69 checks passed
@danielroe
danielroe deleted the feat/rsbuild-dev-server branch July 15, 2026 12:17
@github-actions github-actions Bot mentioned this pull request Jul 15, 2026
5 tasks
@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
@github-actions github-actions Bot mentioned this pull request Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x ✨ enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.