@aspect_rules_esbuild//esbuild:defs.bzl
Public API
Functions & Macros
esbuildesbuild helper macro around the esbuild_bundle rule
For a full list of attributes, see the esbuild_bundle rule
Parameters
*name | The name used for this rule and output files |
output_dir | If Default: False |
splitting | If Default: False |
config | an esbuild configuration file Default: None |
kwargs | All other args from |
Rules
esbuild_bundleRuns the esbuild bundler under Bazel
For further information about esbuild, see https://esbuild.github.io/
Note: to prevent esbuild from following symlinks and leaving the bazel sandbox, a custom bazel-sandbox resolver plugin is used in this rule. See https://github.com/aspect-build/rules_esbuild/issues/58 for more info.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
args_file | label | Internal use only Default: None |
define | dictionary: String → String | A dict of global identifier replacements. Values are subject to $(location ...) expansion.
See https://esbuild.github.io/api/#define for more details Default: {} |
deps | list of labels | A list of direct dependencies that are required to build the bundle Default: [] |
data | list of labels | Runtime dependencies to include in binaries/tests that depend on this target. Follows the same semantics as Default: [] |
entry_point | label | The bundle's entry point (e.g. your main.js or app.js or index.js) This is a shortcut for the Default: None |
entry_points | list of labels | The bundle's entry points (e.g. your main.js or app.js or index.js) Specify either this attribute or Default: [] |
external | list of strings | A list of module names that are treated as external and not included in the resulting bundle See https://esbuild.github.io/api/#external for more details Default: [] |
format | string | The output format of the bundle, defaults to iife when platform is browser See https://esbuild.github.io/api/#format for more details Default: "" |
launcher | label | Override the default esbuild wrapper, which is supplied by the esbuild toolchain Default: None |
max_threads | integer | Sets the Default: 0 |
metafile | boolean | If true, esbuild creates a metafile along with the output Default: False |
minify | boolean | Minifies the bundle with the built in minification. Sets all --minify-* flags See https://esbuild.github.io/api/#minify for more details Default: False |
output | label | Name of the output file when bundling Default: None |
output_css | label | Declare a .css file will be output next to output bundle. If your JS code contains import statements that import .css files, esbuild will place the Default: None |
output_dir | boolean | If true, esbuild produces an output directory containing all output files Default: False |
output_map | label | Name of the output source map when bundling Default: None |
platform | string | The platform to bundle for. See https://esbuild.github.io/api/#platform for more details Default: "browser" |
sourcemap | string | Defines where sourcemaps are output and how they are included in the bundle. If See https://esbuild.github.io/api/#sourcemap for more details Default: "" |
sources_content | boolean | If False, omits the See https://esbuild.github.io/api/#sources-content for more details Default: False |
splitting | boolean | If true, esbuild produces an output directory containing all the output files from code splitting for multiple entry points See https://esbuild.github.io/api/#splitting and https://esbuild.github.io/api/#entry-points for more details Default: False |
srcs | list of labels | Source files to be made available to esbuild Default: [] |
target | list of strings | Environment target (e.g. es2017, chrome58, firefox57, safari11, See https://esbuild.github.io/api/#target for more details Default: ["es2015"] |
bundle | boolean | If true, esbuild will bundle the input files, inlining their dependencies recursively Default: True |
config | label | Configuration file used for esbuild. Note that options set in this file may get overwritten. If you formerly used Default: None |
*tsconfig | label | TypeScript configuration file used by esbuild. Default to an empty file with no configuration. See https://esbuild.github.io/api/#tsconfig for more details |
bazel_sandbox_plugin | boolean | If true, a custom bazel-sandbox plugin will be enabled that prevents esbuild from leaving the Bazel sandbox. Default: True |
esbuild_log_level | string | Set the logging level of esbuild. We set a default of "warmning" since the esbuild default of "info" includes See https://esbuild.github.io/api/#log-level for more details. Default: "warning" |
js_log_level | string | Set the logging level for js_binary launcher and the JavaScript bazel-sandbox plugin. Log levels: fatal, error, warn, info, debug Default: "error" |
node_toolchain | label | The Node.js toolchain to use for this target. See https://bazelbuild.github.io/rules_nodejs/Toolchains.html Typically this is left unset so that Bazel automatically selects the right Node.js toolchain Default: None |