rules_esbuild icon indicating copy to clipboard operation
rules_esbuild copied to clipboard

esbuild output with `preserveSymlinks = false` contains machine-specific relative paths

Open jfirebaugh opened this issue 3 years ago • 2 comments

Originally reported in https://github.com/aspect-build/rules_esbuild/pull/32#issuecomment-1193356744:

Another problem with preserveSymlinks = false for our needs in Bazel is that ESBuild leaves comments in the output that contain resolved file paths. With preserveSymlinks = false these can refer to paths like .../home/matt/.cache/bazel_matt/.../.../... which, across different users and checkouts, will generate downstream cache misses on actions that depend on the outputs.

At Figma we encountered this issue with a write_source_files target that writes an esbuild bundle. The associated diff_test fails with rules_esbuild 0.12+ because the generated relative path differs between local development and CI.

jfirebaugh avatar Sep 06 '22 18:09 jfirebaugh

Related to #58.

cgrindel avatar Oct 04 '22 16:10 cgrindel

As a workaround, you could write another rule after the esbuild to sanitize paths in the file before passing it to write_source_files

alexeagle avatar Mar 27 '23 16:03 alexeagle