Skip to content

feat(sourcemap): support relative paths in inline source maps#13974

Merged
SyMind merged 7 commits into
mainfrom
fix-relative-resource-path-bug
May 12, 2026
Merged

feat(sourcemap): support relative paths in inline source maps#13974
SyMind merged 7 commits into
mainfrom
fix-relative-resource-path-bug

Conversation

@SyMind

@SyMind SyMind commented May 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Support [relative-resource-path] for inline source maps by using the emitted asset path as the base when no separate source map file is generated.
  • Add a config case covering inline source maps emitted at different asset directory depths.
  • Update the English and Chinese output.devtoolModuleFilenameTemplate docs to describe the base path behavior for external and inline source maps.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings May 9, 2026 10:37
@github-actions github-actions Bot added the release: feature release: feature related release(mr only) label May 9, 2026
@SyMind

SyMind commented May 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 9, 2026

Copy link
Copy Markdown

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

Latest commit: aff61ac
Status: ✅  Deploy successful!
Preview URL: https://21a6789d.rspack-v2.pages.dev
Branch Preview URL: https://fix-relative-resource-path-b.rspack-v2.pages.dev

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates Rspack’s sourcemap generation to correctly support [relative-resource-path] when using inline source maps, by treating the emitted asset location as the base path (since the sourcemap is embedded in the asset). It also updates docs and adds/extends config-case coverage to validate relative sources paths for both external and inline sourcemaps across different output directories.

Changes:

  • Adjust SourceMapDevToolPlugin to compute the base path for [relative-resource-path] as the emitted asset path when sourcemaps are inlined.
  • Introduce canonicalization/rendering logic for relative source names to enable per-sourcemap rendering while still deduplicating source names.
  • Update EN/ZH docs and add a new inline sourcemap config-case test.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
website/docs/zh/config/output.mdx Documents [relative-resource-path] behavior for inline sourcemaps (base = emitted asset dir).
website/docs/en/config/output.mdx Same doc update for English docs.
tests/rspack-test/configCases/source-map/relative-resource-path/test.config.js Updates the case to validate multiple bundles (shallow + nested output).
tests/rspack-test/configCases/source-map/relative-resource-path/rspack.config.js Extends assertions to check sources are relative to each .map directory for multiple emitted maps.
tests/rspack-test/configCases/source-map/relative-resource-path-inline/test.config.js Adds new config-case bundle selection for inline sourcemaps.
tests/rspack-test/configCases/source-map/relative-resource-path-inline/src/index.js New inline sourcemap fixture entry.
tests/rspack-test/configCases/source-map/relative-resource-path-inline/src/button/index.js New inline sourcemap fixture module.
tests/rspack-test/configCases/source-map/relative-resource-path-inline/rspack.config.js Adds inline-sourcemap assertions by parsing the embedded base64 sourcemap.
crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs Core implementation changes: inline base path handling + new source-name canonicalization/rendering.
crates/rspack_plugin_devtool/Cargo.toml Adds url dependency for canonicalization logic.
Cargo.lock Locks url as a dependency for rspack_plugin_devtool.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs Outdated

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

Copy link
Copy Markdown

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.

Reviewed commit: 0151a86af5

ℹ️ 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".

Comment thread crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs Outdated
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 1cb746d to perf: reduce code splitter allocation and lookup overhead (#13968) by harpsealjs

❌ Size increased by 12.00KB from 61.96MB to 61.97MB (⬆️0.02%)

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 6 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB 0
react-10k 5.7 MB 0
react-1k 826.3 KB 0
react-5k 2.7 MB 0
rome 1.6 MB 0
ui-components 4.8 MB 0

Generated by Rsdoctor GitHub Action

@codspeed-hq

codspeed-hq Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 34 untouched benchmarks
⏩ 25 skipped benchmarks1


Comparing fix-relative-resource-path-bug (1cb746d) with main (fc1e4ef)

Open in CodSpeed

Footnotes

  1. 25 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@SyMind SyMind force-pushed the fix-relative-resource-path-bug branch from ee7d2e7 to 9ab889b Compare May 9, 2026 11:21
@SyMind SyMind force-pushed the fix-relative-resource-path-bug branch from 9ab889b to b7f674e Compare May 9, 2026 11:27
@SyMind

SyMind commented May 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

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

Copy link
Copy Markdown

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.

Reviewed commit: b7f674ede8

ℹ️ 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".

Comment thread crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs Outdated
@SyMind SyMind marked this pull request as draft May 11, 2026 01:58
@SyMind

SyMind commented May 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ 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".

@SyMind SyMind marked this pull request as ready for review May 11, 2026 02:58

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

Copy link
Copy Markdown

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.

Reviewed commit: 3071601f10

ℹ️ 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".

Comment thread crates/rspack_plugin_devtool/src/module_filename_helpers.rs Outdated
@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📝 Rspack Ecosystem CI: Open

suite result
rspress ✅ success
rsbuild ❌ failure
rslib ✅ success
rstest ✅ success
rsdoctor ✅ success
plugin ❌ failure
examples ✅ success
devserver ✅ success
lynx-stack ❌ failure
rsbuild-rsc-plugin ✅ success
modernjs ❌ failure

@SyMind

SyMind commented May 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ 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".

@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

📝 Benchmark detail: Open

Name Base (fafedfd) Current Change
10000_big_production-mode_disable-minimize + exec 13.9 s ± 119 ms 13.8 s ± 213 ms -0.57 %
10000_development-mode + exec 898 ms ± 40 ms 887 ms ± 33 ms -1.27 %
10000_development-mode_hmr + stats 159 ms ± 5.9 ms 159 ms ± 3.7 ms +0.07 %
10000_development-mode_noop-loader + exec 1.96 s ± 90 ms 1.92 s ± 64 ms -2.33 %
10000_production-mode + exec 988 ms ± 29 ms 1.01 s ± 13 ms +2.10 %
10000_production-mode_persistent-cold + exec 1.15 s ± 16 ms 1.16 s ± 48 ms +0.94 %
10000_production-mode_persistent-hot + exec 593 ms ± 11 ms 595 ms ± 4.6 ms +0.20 %
10000_production-mode_source-map + exec 1.16 s ± 43 ms 1.16 s ± 30 ms +0.48 %
arco-pro_development-mode + exec 1.3 s ± 104 ms 1.33 s ± 109 ms +2.03 %
arco-pro_development-mode_hmr + stats 34 ms ± 1 ms 33 ms ± 0.56 ms -0.11 %
arco-pro_production-mode + exec 2.4 s ± 70 ms 2.39 s ± 99 ms -0.59 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.47 s ± 65 ms 2.5 s ± 107 ms +1.10 %
arco-pro_production-mode_persistent-cold + exec 2.46 s ± 115 ms 2.45 s ± 59 ms -0.38 %
arco-pro_production-mode_persistent-hot + exec 344 ms ± 3.7 ms 344 ms ± 9.5 ms 0.00 %
arco-pro_production-mode_source-map + exec 2.83 s ± 93 ms 2.86 s ± 117 ms +0.90 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.45 s ± 114 ms 2.41 s ± 65 ms -1.64 %
bundled-threejs_development-mode + exec 181 ms ± 5 ms 181 ms ± 4.7 ms 0.00 %
bundled-threejs_production-mode + exec 212 ms ± 8.1 ms 211 ms ± 8.5 ms -0.28 %
large-dyn-imports_development-mode + exec 1.13 s ± 44 ms 1.16 s ± 36 ms +2.54 %
large-dyn-imports_production-mode + exec 1.26 s ± 35 ms 1.26 s ± 47 ms 0.00 %
threejs_development-mode_10x + exec 813 ms ± 22 ms 800 ms ± 27 ms -1.67 %
threejs_development-mode_10x_hmr + stats 109 ms ± 4 ms 110 ms ± 5.3 ms +0.78 %
threejs_production-mode_10x + exec 2.92 s ± 28 ms 2.9 s ± 33 ms -0.50 %
threejs_production-mode_10x_persistent-cold + exec 3.03 s ± 54 ms 3 s ± 18 ms -1.00 %
threejs_production-mode_10x_persistent-hot + exec 384 ms ± 4.9 ms 381 ms ± 14 ms -0.57 %
threejs_production-mode_10x_source-map + exec 3.63 s ± 92 ms 3.61 s ± 84 ms -0.50 %
10000_big_production-mode_disable-minimize + rss memory 2051 MiB ± 35.6 MiB 2035 MiB ± 67.3 MiB -0.79 %
10000_development-mode + rss memory 597 MiB ± 10.8 MiB 583 MiB ± 15.9 MiB -2.47 %
10000_development-mode_hmr + rss memory 814 MiB ± 24.7 MiB 807 MiB ± 33.3 MiB -0.82 %
10000_development-mode_noop-loader + rss memory 895 MiB ± 12.9 MiB 890 MiB ± 10.4 MiB -0.66 %
10000_production-mode + rss memory 547 MiB ± 21.5 MiB 537 MiB ± 18 MiB -1.83 %
10000_production-mode_persistent-cold + rss memory 740 MiB ± 8.03 MiB 742 MiB ± 9.72 MiB +0.39 %
10000_production-mode_persistent-hot + rss memory 641 MiB ± 18.6 MiB 631 MiB ± 19.6 MiB -1.51 %
10000_production-mode_source-map + rss memory 531 MiB ± 30 MiB 535 MiB ± 23.3 MiB +0.81 %
arco-pro_development-mode + rss memory 487 MiB ± 7.13 MiB 483 MiB ± 16 MiB -0.72 %
arco-pro_development-mode_hmr + rss memory 499 MiB ± 13.5 MiB 499 MiB ± 17.6 MiB -0.14 %
arco-pro_production-mode + rss memory 686 MiB ± 7.7 MiB 680 MiB ± 18.9 MiB -0.82 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 696 MiB ± 19.1 MiB 697 MiB ± 7.85 MiB +0.15 %
arco-pro_production-mode_persistent-cold + rss memory 748 MiB ± 8.55 MiB 745 MiB ± 7.65 MiB -0.44 %
arco-pro_production-mode_persistent-hot + rss memory 377 MiB ± 23.5 MiB 370 MiB ± 19.9 MiB -1.80 %
arco-pro_production-mode_source-map + rss memory 762 MiB ± 22 MiB 768 MiB ± 28.4 MiB +0.71 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 692 MiB ± 5.14 MiB 687 MiB ± 28.7 MiB -0.65 %
bundled-threejs_development-mode + rss memory 150 MiB ± 9.25 MiB 154 MiB ± 10.4 MiB +2.25 %
bundled-threejs_production-mode + rss memory 179 MiB ± 10.2 MiB 177 MiB ± 5.99 MiB -0.98 %
large-dyn-imports_development-mode + rss memory 603 MiB ± 15.5 MiB 595 MiB ± 22.2 MiB -1.23 %
large-dyn-imports_production-mode + rss memory 459 MiB ± 6.3 MiB 464 MiB ± 13.6 MiB +1.21 %
threejs_development-mode_10x + rss memory 537 MiB ± 16.4 MiB 536 MiB ± 16 MiB -0.06 %
threejs_development-mode_10x_hmr + rss memory 677 MiB ± 13.8 MiB 671 MiB ± 20.9 MiB -0.86 %
threejs_production-mode_10x + rss memory 719 MiB ± 10.8 MiB 721 MiB ± 5.83 MiB +0.21 %
threejs_production-mode_10x_persistent-cold + rss memory 676 MiB ± 14.6 MiB 675 MiB ± 18.2 MiB -0.18 %
threejs_production-mode_10x_persistent-hot + rss memory 473 MiB ± 6.47 MiB 471 MiB ± 11.7 MiB -0.42 %
threejs_production-mode_10x_source-map + rss memory 842 MiB ± 25.8 MiB 839 MiB ± 44.9 MiB -0.34 %

Base persistent cache hit rate:

  • 10000_production-mode_persistent-cold: 0.00%
  • arco-pro_production-mode_persistent-cold: 0.00%
  • threejs_production-mode_10x_persistent-cold: 0.00%
    Current persistent cache hit rate:
  • 10000_production-mode_persistent-cold: 0.00%
  • arco-pro_production-mode_persistent-cold: 0.00%
  • threejs_production-mode_10x_persistent-cold: 0.00%

@SyMind SyMind merged commit 7685829 into main May 12, 2026
35 checks passed
@SyMind SyMind deleted the fix-relative-resource-path-bug branch May 12, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants