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
While looking into why our builds were not perfectly reproducing between different systems, I ended up finding that in some cases, absolute paths end up in the source map file, causing the hash to change.
I’m not sure why this has to be an absolute path, nor why these should be part of the sourcemap, and as this causes differences between builds on different systems, I’d love to get rid of it.
The text was updated successfully, but these errors were encountered:
Thanks for the report. I intend to have output files be deterministic across different systems so this is a bug.
This happens because esbuild uses absolute paths internally to represent file identity, esbuild converts absolute file system paths to relative paths for output file determinism, and esbuild only interprets paths in the file namespace as file system paths. Paths in other namespaces could be in an arbitrary format that is up to whichever plugin made them, and esbuild deliberately doesn't change with those paths to avoid messing with the plugin.
The change to preserve non-file paths was made with the introduction of the plugin API. However, that broke this internal code which uses the empty namespace for these files. One way to fix this could be to use some other mechanism instead of the empty namespace to flag empty modules.
While looking into why our builds were not perfectly reproducing between different systems, I ended up finding that in some cases, absolute paths end up in the source map file, causing the hash to change.
Example (snippet from .map file):
Turns out, this is caused by the
browser
field in thepackage.json
of dependencies. In this case: https://github.com/paperjs/paper.js/blob/095671073b9cfed2221b48aea54776ca6f2aed70/package.json#L45-L52I believe this is caused by the
resolver
, specifically:esbuild/internal/resolver/resolver.go
Line 400 in 9580aa8
And
esbuild/internal/resolver/resolver.go
Lines 452 to 457 in 9580aa8
I’m not sure why this has to be an absolute path, nor why these should be part of the sourcemap, and as this causes differences between builds on different systems, I’d love to get rid of it.
The text was updated successfully, but these errors were encountered: