fix(browserLogs): correct source path resolution#6449
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the browser log parsing logic to correctly resolve source paths in source maps, supporting both absolute and relative paths that may be customized via Rspack's output.devtoolModuleFilenameTemplate option.
Key Changes:
- Introduced a new helper function
getRelativeSourcePathto normalize both absolute and relative source paths before computing the path relative to the project root - Added comprehensive test coverage with two test cases validating both absolute and relative source path scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/server/browserLogs.ts | Added getRelativeSourcePath helper function to handle both absolute and relative source paths, replacing direct path.relative call |
| e2e/cases/browser-logs/custom-source-map/src/index.js | Added minimal test source file that throws an error for testing source map resolution |
| e2e/cases/browser-logs/custom-source-map/index.test.ts | Added test cases validating source map parsing with both absolute and relative path configurations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Summary
Rsbuild users can modify the source paths in source maps via Rspack's
output.devtoolModuleFilenameTemplateoption.This PR improves the browser log parsing logic to correctly handle both absolute and relative paths.
Checklist