Skip to content

refactor: simplify public directory path formatting#6363

Merged
chenjiahan merged 5 commits intomainfrom
public_dir_formartting_1015
Oct 15, 2025
Merged

refactor: simplify public directory path formatting#6363
chenjiahan merged 5 commits intomainfrom
public_dir_formartting_1015

Conversation

@chenjiahan
Copy link
Member

Summary

Normalize public dir to absolute paths in config normalization phase and reduce redundant path joining logic.

Checklist

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

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

netlify bot commented Oct 15, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 11f9f7d
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68ef37e057b3680008d20996
😎 Deploy Preview https://deploy-preview-6363--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: 70 (🟢 up 13 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 refactors the public directory path handling by normalizing paths to absolute paths during the config normalization phase, eliminating redundant path resolution logic scattered throughout the codebase.

Key Changes:

  • Moved public directory path normalization to the config normalization phase
  • Removed path joining logic from middleware, plugin, and HTML processing code
  • Added rootPath parameter to normalizeConfig and normalizeConfigStructure functions

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/defaultConfig.ts Enhanced normalizePublicDirs to resolve relative paths to absolute paths during config normalization, added validation for empty string paths
packages/core/src/provider/initConfigs.ts Updated calls to normalizeConfig and normalizeConfigStructure to pass rootPath parameter
packages/core/src/server/devMiddlewares.ts Removed pwd parameter and path normalization logic, now uses pre-normalized absolute paths
packages/core/src/server/devServer.ts Removed pwd argument from getDevMiddlewares call
packages/core/src/plugins/server.ts Removed path normalization logic, uses pre-normalized absolute paths directly
packages/core/src/plugins/html.ts Simplified favicon path collection by removing redundant path normalization
e2e/cases/html/favicon/index.test.ts Changed test config from array to object format for publicDir

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

@chenjiahan chenjiahan merged commit 386c0ad into main Oct 15, 2025
11 checks passed
@chenjiahan chenjiahan deleted the public_dir_formartting_1015 branch October 15, 2025 06:08
@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