Skip to content

feat: truncate long import traces with hidden count#6782

Merged
chenjiahan merged 2 commits intomainfrom
import_traces_cut_1215
Dec 15, 2025
Merged

feat: truncate long import traces with hidden count#6782
chenjiahan merged 2 commits intomainfrom
import_traces_cut_1215

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

This PR improves the readability of import trace output.

When an import trace is long, it now shows at most four entries. The middle part is collapsed and displayed as … (N hidden).

This keeps the most relevant context while significantly reducing log noise for large dependency chains.

Before

Import traces (entry → error):
  ./src/index.js
  ./src/child1.js
  ./src/child2.js
  ./src/child3.js
  ./src/child4.js
  ./src/child5.js
  ./src/child6.js ×

After

Import traces (entry → error):
  ./src/index.js
  ./src/child1.js
  … (3 hidden)
  ./src/child5.js
  ./src/child6.js ×

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 15, 2025 11:01
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@netlify
Copy link
Copy Markdown

netlify bot commented Dec 15, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 15f6177
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/693feb150b134500082a7068
😎 Deploy Preview https://deploy-preview-6782--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 68 (🟢 up 12 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces truncation for long import traces in error diagnostics to improve readability. When a trace exceeds 4 entries, the middle portion is collapsed and replaced with … (N hidden), showing only the first 2 and last 2 entries.

Key changes:

  • Truncation logic limits traces to 4 entries maximum (2 head + 2 tail) in non-verbose mode
  • End-to-end test validates the truncation behavior with a 7-file import chain

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/helpers/format.ts Implements truncation logic for module traces exceeding 4 entries
e2e/cases/diagnostic/import-traces-cut/index.test.ts Tests truncation behavior in both dev and build modes
e2e/cases/diagnostic/import-traces-cut/src/*.js Test fixtures creating a 7-level import chain to trigger truncation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit 70fb81b into main Dec 15, 2025
10 checks passed
@chenjiahan chenjiahan deleted the import_traces_cut_1215 branch December 15, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants