You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: fill missing sourcesContent from the module resource when emitting source maps #16348
Written with the help of an AI coding agent (Claude); reproduced locally on @rspack/core 2.3.0 and webpack 5.112.2.
What problem does this feature solve?
A loader that turns one file into several modules (vue-loader blocks; in our case TanStack Router splitting a route file into a route module and lazy chunks) has two options for its maps' sourcesContent:
Embed the whole file. The module hash includes the map, so an edit to one part of the file puts every module of that file in the hot update, even those whose code didn't change. This is the mechanism behind [Bug]: Child HMR not working when parent component has HMR #11635.
Today the only way to get both is to fill sourcesContent in the emitted .map assets during processAssets. That parses and re-serializes the maps on the JS thread on every rebuild.
What does the proposed API of configuration look like?
An opt-in that fills missing sourcesContent entries from the module's resource file when the devtool plugin emits a map, after module hashes are computed. For example:
After investigating this, I don’t currently see a small, robust solution on Rspack’s side.
Browsers associate source maps with specific scripts through the SourceMap response header or a sourceMappingURL comment. Updating the .map file alone does not automatically refresh the map attached to an already-loaded script. With Rspack’s current HMR pipeline, source-map changes therefore need to participate in invalidation, even when the generated JavaScript is unchanged.
Filling sourcesContent only when emitting the final map does not address this synchronization problem.
For TanStack, the more practical trade-offs may be:
Omit sourcesContent from these split modules’ loader maps. To preserve original-source debugging, the sources URLs would need to be fetchable.
Stop generating source maps for these split modules, accepting the reduced debugging support.
Activity
SyMind commentedon Nov 17, 2026
After investigating this, I don’t currently see a small, robust solution on Rspack’s side.
Browsers associate source maps with specific scripts through the
SourceMapresponse header or asourceMappingURLcomment. Updating the.mapfile alone does not automatically refresh the map attached to an already-loaded script. With Rspack’s current HMR pipeline, source-map changes therefore need to participate in invalidation, even when the generated JavaScript is unchanged.Filling
sourcesContentonly when emitting the final map does not address this synchronization problem.For TanStack, the more practical trade-offs may be:
sourcesContentfrom these split modules’ loader maps. To preserve original-source debugging, thesourcesURLs would need to be fetchable.