Skip to content

Conversation

@yifancong
Copy link
Contributor

@yifancong yifancong commented Dec 15, 2025

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)

Copilot AI review requested due to automatic review settings December 15, 2025 03:00
@netlify
Copy link

netlify bot commented Dec 15, 2025

Deploy Preview for rsdoctor ready!

Name Link
🔨 Latest commit 320e56a
🔍 Latest deploy log https://app.netlify.com/projects/rsdoctor/deploys/6940d0481ade7c00082c6043
😎 Deploy Preview https://deploy-preview-1450--rsdoctor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
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 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 assetsWithoutSourceMap parameter 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.

Copy link
Contributor

Copilot AI commented Dec 16, 2025

@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.

@yifancong yifancong changed the title Optimize: parse module logic optimize: when the aseet no map will use parse module logic Dec 16, 2025
@fi3ework fi3ework changed the title optimize: when the aseet no map will use parse module logic fix: when the aseet no map will use parse module logic Dec 16, 2025
@yifancong yifancong merged commit fa18a67 into main Dec 16, 2025
9 checks passed
@yifancong yifancong deleted the tweaks/parse-module branch December 16, 2025 03:29
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.

3 participants