Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

Add support for displaying formatted error messages when imports fail in data-uri virtual modules.

This includes truncating long snippets and clearly indicating the source as a data-uri module. Also add e2e tests to verify the behavior in both dev and build modes.

Before

Screenshot 2025-12-01 at 21 01 18

After

Screenshot 2025-12-01 at 21 11 46

Checklist

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

Copilot AI review requested due to automatic review settings December 1, 2025 13:24
@chatgpt-codex-connector
Copy link

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

netlify bot commented Dec 1, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit d3d74dc
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/692d9943cc76e800085f22cc
😎 Deploy Preview https://deploy-preview-6677--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: 76 (🟢 up 5 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
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 formatting for data-uri virtual module imports by providing clearer, more concise error messages. When imports fail in data-uri modules, the error messages now display a user-friendly label "data-uri virtual module" along with a truncated snippet of the content (limited to 30 characters) instead of showing the full data-uri which can be extremely long.

Key Changes:

  • Added data-uri detection and formatting logic in the error formatter
  • Implemented snippet truncation (30 character limit with ellipsis)
  • Added comprehensive e2e tests for both dev and build modes

Reviewed changes

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

File Description
packages/core/src/helpers/format.ts Adds data-uri detection and formatting logic with snippet truncation to improve error message readability
e2e/cases/diagnostic/data-uri-import-error/src/index.js Test fixture that imports a non-existent module via data-uri to trigger an error
e2e/cases/diagnostic/data-uri-import-error/index.test.ts E2e tests verifying proper error formatting in both dev and build modes

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenjiahan chenjiahan merged commit d899b13 into main Dec 2, 2025
11 checks passed
@chenjiahan chenjiahan deleted the data_uri_diagnostic_1201 branch December 2, 2025 02:18
@chenjiahan chenjiahan mentioned this pull request Dec 2, 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