Skip to content

fix(cli): avoid double prerender with vite builder - #4833

Merged
pi0 merged 1 commit into
mainfrom
fix/vite-cli-double-prerender
Oct 18, 2026
Merged

pi0 merged 1 commit into
mainfrom
fix/vite-cli-double-prerender

Conversation

@pi0x

@pi0x pi0x commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

With builder: "vite", nitro build and nitro deploy (without --prebuilt) called copyPublicAssets() and prerender() before build(), then the vite builder did both again from its buildApp hook. So routes were prerendered twice, and the first pass ran before the client build.

The CLI now skips both steps for the vite builder. A regression test runs nitro build on a vite fixture and checks that prerender:init fires once.

🤖 Generated with AI assistant

`nitro build` and `nitro deploy` copied public assets and prerendered
before `build()`, and the vite builder did both again from its
`buildApp` hook after the client build.
@pi0x
pi0x requested a review from pi0 as a code owner October 18, 2026 00:52
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
nitro.build Ready Ready Preview Oct 18, 2026 12:52am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 18, 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: 754fec9c-4a6e-49d1-ae4e-ea477dd570d5
📥 Commits

Reviewing files that changed from the base of the PR and between a6128d9 and fefebf8.

📒 Files selected for processing: 5
  • src/cli/commands/build.ts
  • src/cli/commands/deploy.ts
  • test/vite/cli-build-fixture/nitro.config.ts
  • test/vite/cli-build-fixture/server.ts
  • test/vite/cli-build.test.ts
+-------------------------------------------------------------------+
| This refactor is like rearranging furniture during an earthquake. |
+-------------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ 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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: fefebf8

@pi0
pi0 merged commit bb9894f into main Oct 18, 2026
13 of 14 checks passed
@pi0
pi0 deleted the fix/vite-cli-double-prerender branch October 18, 2026 00:54

This branch was successfully deployed

1 active deployment
Preview — fefebf8e Deployed Oct 18, 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