-
-
Notifications
You must be signed in to change notification settings - Fork 89
fix: when the aseet no map will use parse module logic #1450
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 rsdoctor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 optimizes the module parsing logic by enabling parallel processing of assets with and without sourcemaps, rather than using an exclusive either/or approach. Previously, when sourcemaps existed, AST parsing was completely skipped; now, assets with sourcemaps are parsed using sourcemap data while assets without sourcemaps can be parsed using AST, improving coverage and efficiency.
Key Changes:
- Introduced tracking of assets without sourcemaps to enable selective AST parsing
- Restructured parsing logic to allow both sourcemap-based and AST-based parsing in the same execution
- Added the
assetsWithoutSourceMapparameter throughout the parsing pipeline to support the optimization
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/graph/src/transform/chunks/assetsModules.ts | Core logic restructuring - moved sourcemap parsing before AST parsing and added conditional logic to parse only assets without sourcemaps when appropriate |
| packages/core/src/inner-plugins/plugins/sourcemapTool.ts | Added initialization and population of assetsWithoutSourceMap Set to track JS/CSS assets lacking sourcemaps (rspack only) |
| packages/core/src/inner-plugins/plugins/ensureModulesChunkGraph.ts | Plumbed through the assetsWithoutSourceMap parameter to the module parsing functions |
| packages/core/src/build-utils/build/chunks/assetsModules.ts | Updated wrapper function to accept and pass through the assetsWithoutSourceMap parameter |
| examples/rsbuild-minimal/rsbuild.config.ts | Commented out sourcemap configuration, likely for testing the AST parsing fallback behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@yifancong I've opened a new pull request, #1452, to work on those changes. Once the pull request is ready, I'll request review from you. |
2d883a2 to
a6ff38c
Compare
Summary
It was discovered that, in some cases, certain assets cannot retrieve the map through
asset.source.sourceAndMap().map. Therefore, to address this issue, parsing the AST is used as a fallback when the map is unavailable.In the future, a fundamental solution will also be implemented to address the scenario where, under the Rspack compiler, some assets cannot obtain the map when SourceMap is disabled.
Related Links
web-infra-dev/rsbuild#6749 (comment)