-
-
Notifications
You must be signed in to change notification settings - Fork 746
fix: should generate correct relative path for context modules in sourcemap #12078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this 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 refactors context module identifier generation to use relative paths instead of absolute paths in readable identifiers. The key changes improve path handling to make module identifiers more portable and human-readable.
- Refactored
make_paths_relativeandmake_paths_absoluteto use a newsplit_keeputility that preserves delimiters during path splitting - Updated context module's
readable_identifierto return relative paths based on the context - Enabled several previously disabled test cases for source maps and multi-compiler configurations
Reviewed Changes
Copilot reviewed 41 out of 43 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_util/src/identifier.rs | Implemented split_keep helper and refactored path transformation functions to preserve delimiters |
| crates/rspack_util/Cargo.toml | Added "pattern" feature to regex dependency |
| crates/rspack_core/src/context_module.rs | Updated create_identifier and readable_identifier to support relative paths |
| tests/rspack-test/statsOutputCases/*.txt | Updated test snapshots to reflect relative path identifiers |
| tests/rspack-test/configCases/source-map//index. | Updated tests to use relative paths and enabled previously disabled tests |
| tests/rspack-test/configCases/split-chunks/*/test.config.js | Updated expected chunk filenames |
| tests/rspack-test/configCases/css/*/index.js | Updated expected CSS chunk IDs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/rspack-test/configCases/source-map/eval-nosources-source-map/index.ts
Show resolved
Hide resolved
📦 Binary Size-limit
🎉 Size decreased by 768bytes from 47.85MB to 47.85MB (⬇️0.00%) |
CodSpeed Performance ReportMerging #12078 will not alter performanceComparing Summary
Footnotes |
Summary
The
makePathsRelative()in rspack has a bug which lost delimiter like|and!. And if a module identifier contains these delimiters, the generated relative path can not resume to the original module identifier. Then the source map plugin can not generate correctwebpack://path for these modules.Related links
Checklist