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]: --loader option #103

Open tamuhey opened 1 year ago

tamuhey commented 1 year ago

What is the current behavior?

Not sure how to use --loader option, e.g. --loader:.svg=text

Describe the feature

Allow users to set --loader:.svg=text

Fund our work

gregmagolan commented 1 year ago

Likely just need an example of how to use --loader

Place1 commented 1 year ago

here's a quick example in case somebody would like to use it to contribute a proper example:

esbuild(
    name = "bundle",
    srcs = [":src"],
    config = {
        "loader": {
            ".ttf": "file",
        },
    },
    entry_point = "src/index.js",
)

The "config" parameter seems to accept a dictionary matching the JSON options for the esbuild js api: https://esbuild.github.io/content-types/#file