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

Code Splitting generates empty dir #25

Closed paullewis closed 2 years ago

paullewis commented 2 years ago

Hey!

With the following BUILD.bazel file contents:

load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")

esbuild(
    name = "bundle",
    entry_point = "index.ts",
    splitting = True,
)

I expected a bundle subdir in bazel-bin with the generated JS. The metadata, args, and config files are created, but the bundle subdir remains empty with no generated JS in it. Am I missing a particular attribute?

paullewis commented 2 years ago

Comparing with the esbuild rule from rules_nodejs, and in particular the args.json, I'm wondering if the outdir path is perhaps incorrect. It looks to me as if the outdir path still references bazel-out, whereas the entryPoints now seem to be relative to the bin dir (if I'm reading the file correctly), and I'm assuming the outdir should also be?