aspect-build / rules_esbuild

Bazel rules for https://esbuild.github.io/ JS bundler
https://docs.aspect.build/rules/aspect_rules_esbuild
Apache License 2.0
27 stars 27 forks source link

esbuild fails when depending on a bundle in a local repository #65

Open iteratee opened 2 years ago

iteratee commented 2 years ago

I have two bazel repositories, and I'd like for one to depend on the other. One defines an esbuild macro. (I tried with an esbuild_bundle rule as well), The second imports the first as a local repository:

In the second WORKSPACE, I have:

local_repository(
    name = "bridge-deal",
    path = "/home/kyle/devel/bridge-deal"
)

If I execute bazelisk build "@bridge-deal//:bundle I get the following error:

ERROR: /home/kyle/.cache/bazel/_bazel_kyle/81db66b89528850bd748567d4113aa93/external/bridge-deal/BUILD.bazel:4:15: Bundling Javascript ../bridge-deal/app.ts [esbuild] failed: (Exit 1): launcher.sh failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/esbuild_linux-64/launcher.sh '--esbuild_args=../bridge-deal/bundle.args.json'

I've attached a minimal reproduction. In minimal-repro-js, bazelisk build //:bundle works. in minimal-repro, bazelisk build @minimal-repro-js//:bundle fails with an error similar to the one I posted above. minimal-repro.tar.gz

Hopefully this gives you a hint as to where the problem is.