Skip to content

perf(cli): run nitro serve in-process without buildPlugins - #4865

Merged
pi0 merged 2 commits into
perf/sync-servefrom
perf/serve-self-runner
Oct 20, 2026
Merged

pi0 merged 2 commits into
perf/sync-servefrom
perf/serve-self-runner

Conversation

@pi0x

@pi0x pi0x commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #4862. nitro serve now runs the sources with env-runner's self runner (v0.3.6, which supports listen) instead of a node-worker, unless buildPlugins are configured (their hooks may be async). Measured with the CLI, from process start to first response: ~230ms vs ~310ms, and no worker round trips for module loading.

  • Only the first server of a process runs on the self runner: the Nitro runtime modules it imports stay cached in the process (with the #nitro/virtual/* modules they import), so a second startUnbundledServer() would serve the first app. Later ones use a worker.
  • unbundledPlugins(nitro, { sync: true }) for the self runner: a missing optional runtime dependency fails instead of being installed.
  • Tested end to end with the built CLI: TypeScript, alias, text and wasm imports, import.meta.dev, KV, public assets, WebSocket, graceful SIGINT.
  • Docs updated.

Also updates unwasm to v0.6.2 (synchronous plugin hooks, unjs/unwasm#123), so .wasm imports work on the self runner (covered in test/unbundled/self.test.ts and checked with the built CLI).

🤖 Generated with AI assistant

@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nitro.build Error Error Oct 20, 2026 2:31am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8327e488-b14f-4bcb-b7f9-4ffc43670a9d
📥 Commits

Reviewing files that changed from the base of the PR and between cb9bf2b and 32779e1.

⛔ Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing: 7
  • docs/1.docs/60.cli.md
  • package.json
  • src/build/unbundled/serve.ts
  • src/cli/commands/serve.ts
  • test/unbundled/self.test.ts
  • test/unbundled/serve.test.ts
  • test/unbundled/unbundled.test.ts
+----------------------------+
| Copilot has nothing on me. |
+----------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

socket-security Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedunwasm@​0.6.1 ⏵ 0.6.2100100100 +188 -1100
Addedenv-runner@​0.3.610010010096100

View full report

@pi0
pi0 added this pull request to stack #4866 October 20, 2026 02:19
@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4865

commit: 32779e1

Uses env-runner's self runner (with `listen`) instead of a Node.js worker when no `buildPlugins` may need async hooks.
@pi0x
pi0x marked this pull request as ready for review October 20, 2026 02:31
@pi0x
pi0x requested a review from pi0 as a code owner October 20, 2026 02:31
@pi0
pi0 merged commit 070f821 into main Oct 20, 2026
12 of 14 checks passed
@pi0
pi0 deleted the perf/serve-self-runner branch October 20, 2026 02:32

This branch had an error being deployed

1 failed deployment
Preview — 32779e10 Deployed Oct 20, 2026 by vercel[bot]
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.

2 participants