fix(sourceMap): use absolute paths in dev for VS Code debugging#6492
Merged
chenjiahan merged 1 commit intomainfrom Nov 3, 2025
Merged
fix(sourceMap): use absolute paths in dev for VS Code debugging#6492chenjiahan merged 1 commit intomainfrom
chenjiahan merged 1 commit intomainfrom
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 updates the source map configuration logic to use a function for devtoolModuleFilenameTemplate during development for web targets, ensuring POSIX-style absolute paths for better debugger compatibility. The test snapshots are updated to reflect that the configuration value is now a function rather than a string.
Key Changes
- Modified
devtoolModuleFilenameTemplateto use a function that converts paths to POSIX format during development for web targets - Added conditional logic based on
isDevandtargetparameters - Updated comment to clarify the purpose of the
processAssetscheck
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/plugins/sourceMap.ts | Implements conditional function-based devtoolModuleFilenameTemplate for dev/web builds with POSIX path conversion |
| packages/core/tests/snapshots/environments.test.ts.snap | Updates snapshot to expect [Function] instead of string template |
| packages/core/tests/snapshots/default.test.ts.snap | Updates snapshot to expect [Function] instead of string template (3 occurrences) |
| packages/core/tests/snapshots/builder.test.ts.snap | Updates snapshot to expect [Function] instead of string template |
| packages/compat/webpack/tests/snapshots/default.test.ts.snap | Updates snapshot to expect [Function] instead of string template |
Comments suppressed due to low confidence (1)
packages/core/src/plugins/sourceMap.ts:88
- The
processAssetshook checks ifdevtoolModuleFilenameTemplate !== DEFAULT_SOURCE_MAP_TEMPLATE, but in development mode with web target, the value is now set to a function (lines 45-48), not the string constant. This comparison will always be true when a function is used, causing the hook to incorrectly skip processing source maps in development builds. The check should account for both string templates and function values, or be updated to handle the new function-based approach.
if (
compilation.outputOptions.devtoolModuleFilenameTemplate !==
DEFAULT_SOURCE_MAP_TEMPLATE
) {
return;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. 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
Ensure VS Code and browser debuggers can correctly resolve breakpoints by using POSIX-style absolute paths in source maps during web development.
Related Links
Checklist