Skip to content

feat: add default favicon resolution from public dir#6362

Merged
chenjiahan merged 2 commits intomainfrom
resolve_favicon_1015
Oct 15, 2025
Merged

feat: add default favicon resolution from public dir#6362
chenjiahan merged 2 commits intomainfrom
resolve_favicon_1015

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Oct 15, 2025

Summary

This PR adds default support for resolving public/favicon.[ext], a convention that helps simplify configuration for most web applications.

This behavior aligns with common defaults in tools like Create React App and other web toolings.

By default, .ico, .png, and .svg extensions are supported, which should cover the vast majority of use cases.

Checklist

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

Copilot AI review requested due to automatic review settings October 15, 2025 03:55
@netlify
Copy link

netlify bot commented Oct 15, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 9893a64
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68ef31192d6b3b0008b210c3
😎 Deploy Preview https://deploy-preview-6362--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 (🔴 down 1 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 adds automatic favicon resolution from the public directory, implementing a common convention that simplifies configuration for web applications. When no explicit favicon is configured, the system will look for favicon.ico, favicon.png, or favicon.svg files in public directories.

  • Added default favicon resolution logic that searches public directories for favicon files
  • Enhanced the HTML plugin to use the default favicon as a fallback when no explicit favicon is configured
  • Added comprehensive test coverage for the new default favicon resolution functionality

Reviewed Changes

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

File Description
packages/core/src/plugins/html.ts Implements default favicon resolution logic and integrates it as a fallback in the HTML plugin
e2e/cases/html/favicon/index.test.ts Adds test cases for default favicon resolution and includes code formatting cleanup
Comments suppressed due to low confidence (1)

packages/core/src/plugins/html.ts:1

  • Line 239 assigns defaultFavicon to itself instead of assigning faviconPath. This should be defaultFavicon = faviconPath;
import fs from 'node:fs';

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@chenjiahan chenjiahan merged commit d28997d into main Oct 15, 2025
11 checks passed
@chenjiahan chenjiahan deleted the resolve_favicon_1015 branch October 15, 2025 05:42
@chenjiahan chenjiahan mentioned this pull request Oct 30, 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.

1 participant