feat(sourcemap): support relative paths in inline source maps#13974
Conversation
|
@codex review |
Deploying rspack with
|
| 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 |
There was a problem hiding this comment.
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
SourceMapDevToolPluginto 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.
There was a problem hiding this comment.
💡 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".
📦 Binary Size-limit
❌ Size increased by 12.00KB from 61.96MB to 61.97MB (⬆️0.02%) |
Rsdoctor Bundle Diff AnalysisFound 6 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
Merging this PR will not alter performance
Comparing Footnotes
|
ee7d2e7 to
9ab889b
Compare
9ab889b to
b7f674e
Compare
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
📝 Benchmark detail: Open
Base persistent cache hit rate:
|
Summary
[relative-resource-path]for inline source maps by using the emitted asset path as the base when no separate source map file is generated.output.devtoolModuleFilenameTemplatedocs to describe the base path behavior for external and inline source maps.Related links
Checklist