refactor: simplify public directory path formatting#6363
Merged
chenjiahan merged 5 commits intomainfrom Oct 15, 2025
Merged
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
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
rootPathparameter tonormalizeConfigandnormalizeConfigStructurefunctions
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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