Skip to content

fix(prepare): keep public assets inside output dir when cleaning - #4798

Merged
pi0 merged 1 commit into
v2from
fix/v2-prepare-public-assets
Oct 15, 2026
Merged

pi0 merged 1 commit into
v2from
fix/v2-prepare-public-assets

Conversation

@pi0x

@pi0x pi0x commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Backport of #4685 to v2.

prepare() used to rm -rf the output dirs even when a publicAssets dir was inside one of them (e.g. dist/client with cloudflare-pages), so the assets were silently deleted. On main this now throws. v2 is a stable line, so here it logs a warning and cleans everything in that output dir except the asset dir instead of failing the build. It also handles symlinks, and output dirs that are themselves symlinks keep the old behavior. Main's generatedAssetDirs option is not ported because v2 has no Vite plugin.

🤖 Generated with AI assistant

Backport of #4685 to v2. Instead of throwing, warn and clean everything except the public assets source directory.
@vercel

vercel Bot commented Oct 15, 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 15, 2026 10:00am UTC

Request Review

@pi0x
pi0x requested a review from pi0 as a code owner October 15, 2026 10:00
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e728eb8a-d8aa-4810-89dc-8644e5a0341e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitropack@4798

commit: e44ffd4

@pi0
pi0 merged commit 4e8ea87 into v2 Oct 15, 2026
12 checks passed
@pi0
pi0 deleted the fix/v2-prepare-public-assets branch October 15, 2026 10:05

This branch was successfully deployed

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