Skip to content

fix(browserLogs): correct source path resolution#6449

Merged
chenjiahan merged 2 commits intomainfrom
browser_logs_path_1027
Oct 27, 2025
Merged

fix(browserLogs): correct source path resolution#6449
chenjiahan merged 2 commits intomainfrom
browser_logs_path_1027

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Oct 27, 2025

Summary

Rsbuild users can modify the source paths in source maps via Rspack's output.devtoolModuleFilenameTemplate option.

This PR improves the browser log parsing logic to correctly handle both absolute and relative paths.

Checklist

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

Copilot AI review requested due to automatic review settings October 27, 2025 14:29
@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 54e74c5
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68ff81d15ad39a000820d492
😎 Deploy Preview https://deploy-preview-6449--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: 69 (🟢 up 7 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 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 getRelativeSourcePath to 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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

@chenjiahan chenjiahan merged commit 6b8b1c5 into main Oct 27, 2025
14 checks passed
@chenjiahan chenjiahan deleted the browser_logs_path_1027 branch October 27, 2025 14:50
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

Comments