Skip to content

test(dev): guard against inlining the previous dev build (#40) - #56

Open
ichiken26 wants to merge 1 commit into
nitrojs:mainfrom
ichiken26:test/dev-inline-public-assets
Open

ichiken26 wants to merge 1 commit into
nitrojs:mainfrom
ichiken26:test/dev-inline-public-assets

Conversation

@ichiken26

Copy link
Copy Markdown

🔗 Linked issue

#40

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR adds a regression test for #40.

As described in my previous investigation, the reported issue has already been resolved on the main branch.

This PR adds test coverage to prevent the issue from recurring without changing the existing implementation.

Regression test

The test verifies that:

  • A minimal Nitro application using the cloudflare-module preset is built in development mode.
  • The bundle size remains unchanged across three consecutive rebuilds.
  • /index.mjs and /index.mjs.map are not included as public asset keys in the generated bundle.

Steps to reproduce

The following steps reproduce the original issue on Nitro v2.13.6 and verify the behavior at commit ba32ed7.

1. Reproduce the issue on v2.13.6

git clone https://gist.github.com/804618211528d1712c9fac5ea56df31a.git nitro-repro
cd nitro-repro

npm install --save-exact nitropack@2.13.6
npm ls nitropack
npm run repro

2. Build and package Nitro from source

cd ..

git clone https://github.com/nitrojs/nitro-v2.git
cd nitro-v2

git checkout ba32ed774a24537014258a494ebdca5381f07fd2

pnpm install --frozen-lockfile
pnpm build
pnpm pack

3. Verify the behavior after the fix

cd ../nitro-repro

npm install ../nitro-v2/nitropack-2.14.0.tgz
npm ls nitropack

rm -rf .nitro
npm run repro

Verification results

Build v2.13.6 v2.14.0 (ba32ed7)
Initial build 40 KB 50 KB
Rebuild 1 298 KB 50 KB
Rebuild 2 641 KB 50 KB
Rebuild 3 1,098 KB 50 KB
Rebuild 4 1,708 KB 50 KB
Rebuild 5 2,521 KB 50 KB
Rebuild 6 3,605 KB 50 KB
Rebuild 7 5,051 KB 50 KB
Rebuild 8 6,978 KB 50 KB

Before the fix, the bundle size increases with each rebuild. After the fix, the bundle size remains unchanged across all eight rebuilds.

The regression test guards against this behavior recurring.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

No documentation changes are required, as this PR only adds a regression test.

@ichiken26
ichiken26 requested a review from pi0 as a code owner November 30, 2026 16:09
@vercel

vercel Bot commented Nov 30, 2026

Copy link
Copy Markdown

@ichiken26 is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63966c0c-d272-4d39-8a6d-2e586c5dd023
  • 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

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.

1 participant