Skip to content

feat: improve display path for node_modules in error overlay#6845

Merged
chenjiahan merged 3 commits intomainfrom
overlay_display_path_1226
Dec 27, 2025
Merged

feat: improve display path for node_modules in error overlay#6845
chenjiahan merged 3 commits intomainfrom
overlay_display_path_1226

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

Standardize how file paths are shown in error overlay, especially for files inside node_modules, making stack traces easier to read.

Before

Screenshot 2025-12-26 at 21 51 16

After

Screenshot 2025-12-26 at 21 50 33

Checklist

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

Copilot AI review requested due to automatic review settings December 26, 2025 13:56
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 26, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 117a417
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/694f36ac1621940008119469
😎 Deploy Preview https://deploy-preview-6845--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: 67 (🟢 up 6 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 improves the display of file paths in the error overlay by standardizing how node_modules paths are shown, making stack traces cleaner and easier to read. The implementation extracts the package-relative path from potentially complex nested node_modules structures (e.g., pnpm's .pnpm directory).

Key changes:

  • Introduces formatDisplayPath function to standardize path formatting for error overlays
  • Formats nested node_modules paths (including pnpm's structure) to show only the last node_modules/package/... portion
  • Maintains cross-platform support for both Unix and Windows path separators

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/core/src/server/overlay.ts Adds formatDisplayPath function to handle node_modules path formatting and integrates it into convertLinksInHtml
packages/core/tests/overlay.test.ts Adds comprehensive unit tests for the new formatDisplayPath function covering Unix, Windows, and pnpm scenarios

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

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@chenjiahan chenjiahan merged commit 4eb9a5d into main Dec 27, 2025
11 checks passed
@chenjiahan chenjiahan deleted the overlay_display_path_1226 branch December 27, 2025 01:43
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