aspect-build / aspect-build/rules_esbuild

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

Open
#66 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Starlark
Stars
35
Forks
45
Avg merge
1d 1h
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the preserveSymlinks handling and the linked pull-request discussion, then reproduce the failure with the mentioned write_source_files target and diff_test. Done means esbuild output no longer embeds machine-specific relative paths, so the generated diff is identical across local development and CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.