Skip to content

fix(build): count each output file once in the size report - #4569

Merged
pi0 merged 1 commit into
nitrojs:v2from
maxmaxme:fix/fstree-count-symlinked-files-once-v2
Sep 2, 2026
Merged

pi0 merged 1 commit into
nitrojs:v2from
maxmaxme:fix/fstree-count-symlinked-files-once-v2

Conversation

@maxmaxme

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #4567

v2 backport of #4568 — replace with the number of the main PR once it exists.

❓ 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

Same fix as #4568, against v2 (src/core/utils/fs-tree.ts, which uses globby rather than tinyglobby — the defaults and the fix are identical).

generateFSTree globbed the server output with symlink traversal left at its default, while the output itself is built from directory symlinks — externals traced in more than one version are written to .nitro/<pkg>@<version> and linked into place, both flat and under each parent. Every file behind those links was therefore read, and gzipped when compressedSizes is on, once per path, inflating the reported total.

Disabling traversal alone under-counts: the only real copies sit inside the .nitro dot directory that globs skip by default, so dot is needed too. With both, the report matches the bytes actually on disk.

Verified on 2.13.4 with the reproduction from #4567:

reported real on disk
before 25.2 MB (62.8 kB gzip) 5.2 MB
after 5.15 MB (42.4 kB gzip) 5.2 MB

The remaining 0.05 MB is the three sourcemaps that ignore: ["**/*.map"] now excludes — the previous pattern had no **/, so it matched only the root of the output.

This is the branch we hit in production: a Nuxt 4.5 app on nitropack 2.13.4, where the glob returned 413250 paths for 11415 unique files and the report alone took 98 s of a 4-minute CI build. We currently work around it with nitro.logLevel: 1.

No tests reference generateFSTree, and the change is confined to how the report is gathered — build output is untouched.

📝 Checklist

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

`generateFSTree` globbed the server output with symlink traversal left at its
default, while the output itself is built from directory symlinks: externals
traced in more than one version are written to `.nitro/<pkg>@<version>` and
linked into place, both flat and under each parent. Every file behind those
links was therefore read — and gzipped, when `compressedSizes` is on — once per
path, inflating the reported total.

Disabling symlink traversal alone under-counts, because the only real copies sit
inside the `.nitro` dot directory that globs skip by default, so `dot` is needed
too. With both, the report matches the bytes actually on disk.

Also adds the missing `**/` to the sourcemap ignore pattern, which previously
matched only the root of the output.

v2 backport. Resolves nitrojs#4567
@maxmaxme
maxmaxme requested a review from pi0 as a code owner August 31, 2026 14:52
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@maxmaxme 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 Aug 31, 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: Pro Plus

Run ID: 8d9edad2-d179-4e5e-8dba-23b5fd845698

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

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.

@pi0 pi0 added the v2 label Sep 2, 2026
@pi0x pi0x added the bug Something isn't working label Sep 2, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 984bedb

@pi0
pi0 merged commit 7ca2c39 into nitrojs:v2 Sep 2, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants