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
remove absolute file paths embedded in sourcemaps generated by SourceMapPlugin #1518
When building without a dev server (e.g. a release bundle built in CI), SourceMapPlugin names every module in the source map's sources by its absolute path on the build machine, and there's no way to override this.
The source map ends up depending on where the build ran, not just on its inputs:
Non-reproducible builds. On remote-execution or sandboxed build systems (Bazel, Buck, etc.) the absolute path includes a per-job working directory, so the same commit yields a different map on each worker:
Error-reporting tools show machine-specific paths. Sentry and similar tools display these paths as frame filenames. Because the prefix changes between builds, a single code mapping (stack trace → repository) can't cover them.
The web-oriented default, webpack://[namespace]/[resourcePath], has none of these problems because [resourcePath] is relative to context.
Suggested solution
Honor output.devtoolModuleFilenameTemplate when set, falling back to the current behavior otherwise. This seems to be what the commented-out code intended or
Default to paths relative to compiler.options.context for production builds. That keeps the map reproducible, and tools can still resolve files by joining with the project root.
My plan: when there's no dev server, read output.devtoolModuleFilenameTemplate (the commented-out line in SourceMapPlugin) so users can control sources, and add a test that builds the same fixture from two different folders and checks the maps are identical.
One question before I start: should the default stay absolute (only honour the option), or should sources become relative to compiler.context by default? Relative would make builds reproducible out of the box, but could affect tools that expect absolute paths when symbolicating.
It reports concrete broken behavior in SourceMapPlugin: release source maps embed absolute build-machine paths and the plugin ignores output.devtoolModuleFilenameTemplate, with the relevant code commented out, causing non-reproducible output and machine-specific frame paths.
sorry for the delay responding I have had a lot going on
@JaydeepAgravat if you want to take a look please go ahead, I prefer to maintain backwards compat (i.e keep the existing default) if possible unless its just completely broken by doing so.
Thanks @dannyhw! I'll keep the current default and only use output.devtoolModuleFilenameTemplate when it's set, so existing builds produce the same source maps as today. I'll add a test that builds without the dev server and checks the sources paths.
Opened #1532 for this. It keeps the current default and only uses output.devtoolModuleFilenameTemplate when it's set and the dev server isn't running, with a test that checks sources in both cases.
Activity
JaydeepAgravat commentedon Nov 5, 2026
Hi! I'd like to work on this.
My plan: when there's no dev server, read
output.devtoolModuleFilenameTemplate(the commented-out line inSourceMapPlugin) so users can controlsources, and add a test that builds the same fixture from two different folders and checks the maps are identical.One question before I start: should the default stay absolute (only honour the option), or should
sourcesbecome relative tocompiler.contextby default? Relative would make builds reproducible out of the box, but could affect tools that expect absolute paths when symbolicating.dannyhw commentedon Nov 10, 2026
@apex-sentinel-staging review
apex-sentinel-staging commentedon Nov 10, 2026
Apex Sentinel · Issue review
Suggested label:
bugIt reports concrete broken behavior in SourceMapPlugin: release source maps embed absolute build-machine paths and the plugin ignores output.devtoolModuleFilenameTemplate, with the relevant code commented out, causing non-reproducible output and machine-specific frame paths.
Required sections
apex-sentinel-staging commentedon Nov 10, 2026
I looked at this issue again, as asked. My comment above describes it as it reads now.
dannyhw commentedon Nov 10, 2026
@mjames-c thanks for the report
sorry for the delay responding I have had a lot going on
@JaydeepAgravat if you want to take a look please go ahead, I prefer to maintain backwards compat (i.e keep the existing default) if possible unless its just completely broken by doing so.
JaydeepAgravat commentedon Nov 21, 2026
Thanks @dannyhw! I'll keep the current default and only use
output.devtoolModuleFilenameTemplatewhen it's set, so existing builds produce the same source maps as today. I'll add a test that builds without the dev server and checks thesourcespaths.JaydeepAgravat commentedon Nov 21, 2026
Opened #1532 for this. It keeps the current default and only uses
output.devtoolModuleFilenameTemplatewhen it's set and the dev server isn't running, with a test that checkssourcesin both cases.