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

[FR]: Example usage that builds esbuild from go_binary rule and possible bug with ESBUILD_BINARY_PATH #121

Open gonzojive opened 1 year ago

gonzojive commented 1 year ago

What is the current behavior?

A platform-specific binary release of esbuild is downloaded and used for the esbuild binary. There are notes on how to configure a custom toolchain binary but no quick and easy code snippet.

I am able to get a custom version of esbuild working, but only with modifications of the rules_esbuild source (see https://github.com/aspect-build/rules_esbuild/pull/120 and in particular the change to esbuild.bzl, which seems necessary to properly set the ESBUILD_BINARY_PATH environment variable).

Describe the feature

Add a snippet that can be copy-pasted to easily use the version built from go source.

https://github.com/aspect-build/rules_esbuild/pull/120 allows an alternative binary to be specified like so:

esbuild_register_toolchains(
    name = "esbuild",
    esbuild_version = "0.17.5",
    target_tool = "@com_github_evanw_esbuild//cmd/esbuild",
)

Merging that PR (or something like it) is a possibility, I suppose.

Fund our work

alexeagle commented 1 year ago

@gonzojive as soon as we figure out the question of your org submitting bug bounties, this would be a good candidate.