Skip to content

feat: improve error message filename formatting#6685

Merged
chenjiahan merged 3 commits intomainfrom
format_error_file_path_1202
Dec 3, 2025
Merged

feat: improve error message filename formatting#6685
chenjiahan merged 3 commits intomainfrom
format_error_file_path_1202

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

Make error messages more readable by shortening absolute paths using the project root path. This change modifies the filename formatter to accept and utilize the root path for better path display in error messages.

Before

Screenshot 2025-12-02 at 22 07 51

After

Screenshot 2025-12-02 at 22 14 09

Checklist

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

Copilot AI review requested due to automatic review settings December 2, 2025 14:17
@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 2, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 410c6f8
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/692ef6fd2b06fa0008ced08c
😎 Deploy Preview https://deploy-preview-6685--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 (🔴 down 2 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 error message readability by shortening absolute file paths in error messages to use relative paths from the project root. The changes add a root parameter to formatting functions throughout the error handling pipeline, enabling paths like /Users/path/to/project/src/App.jsx to be displayed as ./src/App.jsx.

Key Changes:

  • Modified formatFileName and formatStatsError to accept a root path parameter for path shortening
  • Updated formatStats to pass the root path when formatting errors and warnings
  • Modified error/warning handlers in socketServer.ts and createCompiler.ts to provide the root path from context

Reviewed changes

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

File Description
packages/core/src/helpers/format.ts Added root path parameter to formatting functions and implemented path shortening logic to replace absolute paths with relative paths
packages/core/src/helpers/stats.ts Updated formatStats to accept and pass root path parameter to error/warning formatters
packages/core/src/server/socketServer.ts Modified error and warning handlers to pass this.context.rootPath to formatStatsError
packages/core/src/provider/createCompiler.ts Updated formatStats call to include options.context.rootPath parameter

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

Comment thread packages/core/src/helpers/format.ts Outdated
chenjiahan and others added 2 commits December 2, 2025 22:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenjiahan chenjiahan merged commit 7e4fffa into main Dec 3, 2025
11 checks passed
@chenjiahan chenjiahan deleted the format_error_file_path_1202 branch December 3, 2025 02:19
@chenjiahan chenjiahan mentioned this pull request Dec 6, 2025
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