perf: use native relative source maps#6798
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 improves build performance by switching from a custom source map transformation hook to using webpack/Rspack's native [relative-resource-path] template. The change removes approximately 70 lines of custom asset processing code that manually converted absolute paths to relative paths in source maps.
Key changes:
- Changed default source map template from
[absolute-resource-path]to[relative-resource-path] - Removed custom
api.processAssetshook that post-processed source maps - Added special handling to keep using absolute path functions for webpack (which doesn't support the native template) and development web targets
- Updated e2e tests to use
rspackTestinstead oftestto skip when running with webpack
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/plugins/sourceMap.ts | Removed custom source map transformation logic and updated to use native [relative-resource-path] template, with fallback for webpack |
| packages/webpack/tests/snapshots/default.test.ts.snap | Updated snapshots to reflect new devtoolModuleFilenameTemplate value |
| packages/core/tests/snapshots/default.test.ts.snap | Updated snapshots to reflect new devtoolModuleFilenameTemplate value |
| packages/core/tests/snapshots/environments.test.ts.snap | Updated snapshot to reflect new devtoolModuleFilenameTemplate value |
| e2e/cases/source-map/basic/index.test.ts | Changed tests from test to rspackTest to skip when running with webpack since it doesn't support the new feature |
💡 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
Changed the default source map template in
pluginSourceMapto use[relative-resource-path]instead of[absolute-resource-path]and remove the custom source map transformation hook.This will improve build performance because the
[relative-resource-path]is a native implementation.Related links
https://rspack.rs/config/output#outputdevtoolmodulefilenametemplate
Checklist