Skip to content

perf: use native relative source maps#6798

Merged
chenjiahan merged 3 commits intomainfrom
relative_source_maps_1217
Dec 23, 2025
Merged

perf: use native relative source maps#6798
chenjiahan merged 3 commits intomainfrom
relative_source_maps_1217

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan commented Dec 17, 2025

Summary

Changed the default source map template in pluginSourceMap to 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

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

Copilot AI review requested due to automatic review settings December 17, 2025 09:41
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 17, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit ea7b8e2
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/694a57ef438ff60008ca2853
😎 Deploy Preview https://deploy-preview-6798--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: 60 (🔴 down 3 from production)
Accessibility: 100 (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
Copy Markdown
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 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.processAssets hook 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 rspackTest instead of test to 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.

Copy link
Copy Markdown

@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 653115d into main Dec 23, 2025
11 checks passed
@chenjiahan chenjiahan deleted the relative_source_maps_1217 branch December 23, 2025 09:02
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.

2 participants