Skip to content

Conversation

@Timeless0911
Copy link
Contributor

Summary

Enhance hint for assets emit name conflict

image

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings November 12, 2025 10:57
@netlify
Copy link

netlify bot commented Nov 12, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit aad2d38
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/69146832411f350008734129
😎 Deploy Preview https://deploy-preview-6559--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: 64 (🔴 down 4 from production)
Accessibility: 97 (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 enhances error reporting by adding a helpful hint when multiple assets emit different content to the same filename, guiding users to adjust their output.filename configuration.

  • Adds hintAssetsConflict function to detect and enhance asset name conflict error messages
  • Integrates the new hint function into the error formatting pipeline
  • Includes an e2e test case to verify the hint is displayed correctly

Reviewed Changes

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

File Description
packages/core/src/helpers/format.ts Adds hintAssetsConflict function and integrates it into the error message formatting
e2e/cases/assets/filename-conflict-hint/src/index.js Test source file that imports two image assets to trigger name conflict
e2e/cases/assets/filename-conflict-hint/rsbuild.config.ts Test configuration that causes asset filename conflict by setting both images to the same name
e2e/cases/assets/filename-conflict-hint/index.test.ts Test case that verifies the hint message is displayed when asset name conflict occurs

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

return message;
}

const hintAssetsConflict = (message: string): string => {
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Inconsistent function declaration style. The function hintAssetsConflict uses arrow function syntax with const, while hintUnknownFiles (line 85) uses traditional function declaration. For consistency within the file, consider changing to: function hintAssetsConflict(message: string): string {

Copilot uses AI. Check for mistakes.
return message;
}

const extraMessage = `You may need to adjust ${color.yellow('output.filename')} configuration to prevent name conflicts. (See ${color.yellow('https://rsbuild.rs/config/output/filename')})`;
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

[nitpick] The long message string on line 151 exceeds typical line length conventions, making it harder to read and maintain. Consider breaking it into multiple lines or using string concatenation for better readability.

Suggested change
const extraMessage = `You may need to adjust ${color.yellow('output.filename')} configuration to prevent name conflicts. (See ${color.yellow('https://rsbuild.rs/config/output/filename')})`;
const extraMessage =
`You may need to adjust ${color.yellow('output.filename')} configuration to prevent name conflicts. `
+ `(See ${color.yellow('https://rsbuild.rs/config/output/filename')})`;

Copilot uses AI. Check for mistakes.
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

👍

@chenjiahan chenjiahan merged commit 097fcad into main Nov 12, 2025
18 checks passed
@chenjiahan chenjiahan deleted the asset-hint branch November 12, 2025 12:39
@chenjiahan chenjiahan mentioned this pull request Nov 12, 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.

3 participants