rules_esbuild icon indicating copy to clipboard operation
rules_esbuild copied to clipboard

[FR]: Should `output_dir` use `output` as the dir name rather than `name?

Open surma opened this issue 2 years ago • 1 comments

What is the current behavior?

It seems that if output_dir is true, a directory artifact is declared using the rule name as the folder name.

https://github.com/aspect-build/rules_esbuild/blob/cede902c94e2313a3ea183b6a5e1dbbbfcf40347/esbuild/private/esbuild.bzl#L255-L257

Describe the feature

I was surprised that when I defined output = "dist" with output_dir = True, that the rule would fail with “The following files have no generating action: .../dist". After digging into the code, it seems that name is used for the folder name. Is that intentional?

surma avatar Dec 01 '23 10:12 surma

I believe this is because the output attribute is a predeclared output file and can not be a directory.

Would an error message have helped if both output and output_dir are set? I think that would be harmless and maybe improve the DX. Want to open a PR adding that?

jbedard avatar Feb 27 '24 08:02 jbedard