| <!DOCTYPE html> |
| <html itemscope itemtype="https://schema.org/WebPage" lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <meta content="IE=edge" http-equiv="X-UA-Compatible"> |
| <meta content="width=device-width, initial-scale=1" name="viewport"> |
| <link href="/rules_nodejs/esbuild.html" rel="canonical"> |
| <link href="" rel="shortcut icon" type="image/png"> |
| |
| <title>rules_nodejs - esbuild</title> |
| |
| <!-- Webfont --> |
| <link href="//fonts.googleapis.com/css?family=Source+Code+Pro:400,500,700|Open+Sans:400,600,700,800" rel="stylesheet"> |
| |
| <!-- Bootstrap --> |
| <link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" |
| integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" rel="stylesheet"> |
| |
| <!-- Font Awesome --> |
| <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> |
| |
| <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> |
| <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> |
| <!--[if lt IE 9]> |
| <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> |
| <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> |
| <![endif]--> |
| |
| <!-- Custom stylesheet --> |
| <link href="/rules_nodejs/css/main.css" rel="stylesheet"> |
| |
| <!-- metadata --> |
| <meta content="rules_nodejs" name="og:title"/> |
| <meta content="JavaScript and NodeJS rules for Bazel" name="og:description"/> |
| </head> |
| |
| <body> |
| <nav class="navbar navbar-inverse navbar-fixed-top" id="common-nav"> |
| <div class="container"> |
| <!-- Brand and toggle get grouped for better mobile display --> |
| <div class="navbar-header"> |
| <button class="navbar-toggle collapsed" data-target="#bs-example-navbar-collapse-1" data-toggle="collapse" |
| type="button"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a class="navbar-brand" href="/rules_nodejs/"> |
| <img class="navbar-logo" src="/rules_nodejs/images/bazel-navbar.svg"> |
| </a> |
| </div> |
| |
| <!-- Collect the nav links, forms, and other content for toggling --> |
| <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |
| <form class="navbar-form navbar-right" action="/rules_nodejs/search.html" id="cse-search-box"> |
| <div class="form-group"> |
| <input type="hidden" name="cx" value="2735dc72dd157bd19"> |
| <input type="search" name="q" id="q" class="form-control input-sm" placeholder="Search"> |
| </div> |
| </form> |
| <ul class="nav navbar-nav navbar-right"> |
| <li><a href="https://github.com/bazelbuild/rules_nodejs">GitHub</a></li> |
| </ul> |
| </div><!-- /.navbar-collapse --> |
| </div><!-- /.container-fluid --> |
| </nav> |
| |
| |
| <div class="container vpad"> |
| <div class="row"> |
| <div class="col-md-2"> |
| <a aria-controls="sidebar-nav" |
| aria-expanded="false" class="btn btn-default btn-lg btn-block sidebar-toggle" data-toggle="collapse" |
| href="#sidebar-nav"> |
| <i class="glyphicon glyphicon-menu-hamburger"></i> Navigation |
| </a> |
| |
| <nav class="sidebar collapse" id="sidebar-nav"> |
| <select onchange="location.href=this.value"> |
| <option selected disabled hidden>Version: 3.x</option> |
| <option value="/rules_nodejs/esbuild.html">3.x</option> |
| <option value="https://docs.aspect.dev/rules_nodejs/esbuild.html">2.3</option> |
| </select> |
| |
| <h3>rules_nodejs</h3> |
| |
| <ul class="sidebar-nav"> |
| <li><a href="/rules_nodejs/">Introduction</a></li> |
| <li><a href="install.html">Installation</a></li> |
| <li><a href="repositories.html">Repositories</a></li> |
| <li><a href="dependencies.html">Dependencies</a></li> |
| <li><a href="debugging.html">Debugging</a></li> |
| <li><a href="stamping.html">Stamping</a></li> |
| <li><a href="changing-rules.html">Making changes to rules_nodejs</a></li> |
| <li><a href="examples.html">Examples</a></li> |
| </ul> |
| |
| <h3>Rules</h3> |
| <ul class="sidebar-nav"> |
| |
| |
| <li><a href="/rules_nodejs/Built-ins.html">Built-ins</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Concatjs.html">Concatjs</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Cypress.html">Cypress</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Jasmine.html">Jasmine</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Labs.html">Labs</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Protractor.html">Protractor</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Providers.html">Providers</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Rollup.html">Rollup</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/Terser.html">Terser</a></li> |
| |
| |
| |
| <li><a href="/rules_nodejs/TypeScript.html">TypeScript</a></li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li><a href="/rules_nodejs/esbuild.html">esbuild</a></li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </ul> |
| |
| <h3>Community</h3> |
| <ul class="sidebar-nav"> |
| <li><a href="https://github.com/bazelbuild/rules_nodejs/blob/master/CONTRIBUTING.md">Contribute to |
| rules_nodejs</a></li> |
| <li><a href="https://slack.bazel.build">Join #javascript on Slack</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_nodejs/issues">Issue Tracker</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_nodejs">Github</a></li> |
| </ul> |
| </nav> |
| </div> |
| |
| |
| <div class="col-md-8"> |
| <div class="content"> |
| <!-- ********************* |
| DO NOT EDIT THIS FILE |
| It is a generated build output from Stardoc. |
| Instead you must edit the .bzl file where the rules are declared, |
| or possibly a markdown file next to the .bzl file |
| ********************* --> |
| |
| <h1 id="esbuild-rules-for-bazel">esbuild rules for Bazel</h1> |
| |
| <p>The esbuild rules runs the <a href="https://github.com/evanw/esbuild">esbuild</a> bundler tool with Bazel. |
| esbuild is an extremely fast JavaScript bundler written in Go, its <a href="https://esbuild.github.io/faq/#benchmark-details">current benchmarks</a> show it can be 320x faster that other bundlers</p> |
| |
| <h2 id="installation">Installation</h2> |
| |
| <p>Add the <code class="language-plaintext highlighter-rouge">@bazel/esbuild</code> npm packages to your <code class="language-plaintext highlighter-rouge">devDependencies</code> in <code class="language-plaintext highlighter-rouge">package.json</code>.</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>npm install --save-dev @bazel/esbuild |
| </code></pre></div></div> |
| <p>or using yarn</p> |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>yarn add -D @bazel/esbuild |
| </code></pre></div></div> |
| |
| <p>Add an <code class="language-plaintext highlighter-rouge">http_archive</code> fetching the esbuild binary for each platform that you need to support.</p> |
| |
| <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">_ESBUILD_VERSION</span> <span class="o">=</span> <span class="s">"0.12.1"</span> <span class="c1"># reminder: update SHAs below when changing this value |
| </span><span class="n">http_archive</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"esbuild_darwin"</span><span class="p">,</span> |
| <span class="n">urls</span> <span class="o">=</span> <span class="p">[</span> |
| <span class="s">"https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-%s.tgz"</span> <span class="o">%</span> <span class="n">_ESBUILD_VERSION</span><span class="p">,</span> |
| <span class="p">],</span> |
| <span class="n">strip_prefix</span> <span class="o">=</span> <span class="s">"package"</span><span class="p">,</span> |
| <span class="n">build_file_content</span> <span class="o">=</span> <span class="s">"""exports_files(["bin/esbuild"])"""</span><span class="p">,</span> |
| <span class="n">sha256</span> <span class="o">=</span> <span class="s">"efb34692bfa34db61139eb8e46cd6cf767a42048f41c8108267279aaf58a948f"</span><span class="p">,</span> |
| <span class="p">)</span> |
| |
| <span class="n">http_archive</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"esbuild_windows"</span><span class="p">,</span> |
| <span class="n">urls</span> <span class="o">=</span> <span class="p">[</span> |
| <span class="s">"https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-%s.tgz"</span> <span class="o">%</span> <span class="n">_ESBUILD_VERSION</span><span class="p">,</span> |
| <span class="p">],</span> |
| <span class="n">strip_prefix</span> <span class="o">=</span> <span class="s">"package"</span><span class="p">,</span> |
| <span class="n">build_file_content</span> <span class="o">=</span> <span class="s">"""exports_files(["esbuild.exe"])"""</span><span class="p">,</span> |
| <span class="n">sha256</span> <span class="o">=</span> <span class="s">"10439647b11c7fd1d9647fd98d022fe2188b4877d2d0b4acbe857f4e764b17a9"</span><span class="p">,</span> |
| <span class="p">)</span> |
| |
| <span class="n">http_archive</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"esbuild_linux"</span><span class="p">,</span> |
| <span class="n">urls</span> <span class="o">=</span> <span class="p">[</span> |
| <span class="s">"https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-%s.tgz"</span> <span class="o">%</span> <span class="n">_ESBUILD_VERSION</span><span class="p">,</span> |
| <span class="p">],</span> |
| <span class="n">strip_prefix</span> <span class="o">=</span> <span class="s">"package"</span><span class="p">,</span> |
| <span class="n">build_file_content</span> <span class="o">=</span> <span class="s">"""exports_files(["bin/esbuild"])"""</span><span class="p">,</span> |
| <span class="n">sha256</span> <span class="o">=</span> <span class="s">"de8409b90ec3c018ffd899b49ed5fc462c61b8c702ea0f9da013e0e1cd71549a"</span><span class="p">,</span> |
| <span class="p">)</span> |
| </code></pre></div></div> |
| |
| <p>These can then be referenced on the <code class="language-plaintext highlighter-rouge">tool</code> attribute of the <code class="language-plaintext highlighter-rouge">esbuild</code> rule.</p> |
| |
| <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">esbuild</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"bundle"</span><span class="p">,</span> |
| <span class="p">...</span> |
| <span class="n">tool</span> <span class="o">=</span> <span class="n">select</span><span class="p">({</span> |
| <span class="s">"@bazel_tools//src/conditions:darwin"</span><span class="p">:</span> <span class="s">"@esbuild_darwin//:bin/esbuild"</span><span class="p">,</span> |
| <span class="s">"@bazel_tools//src/conditions:windows"</span><span class="p">:</span> <span class="s">"@esbuild_windows//:esbuild.exe"</span><span class="p">,</span> |
| <span class="s">"@bazel_tools//src/conditions:linux_x86_64"</span><span class="p">:</span> <span class="s">"@esbuild_linux//:bin/esbuild"</span><span class="p">,</span> |
| <span class="p">}),</span> |
| <span class="p">)</span> |
| </code></pre></div></div> |
| |
| <p>It might be useful to wrap this locally in a macro for better reuseability, see <code class="language-plaintext highlighter-rouge">packages/esbuild/test/tests.bzl</code> for an example.</p> |
| |
| <p>The <code class="language-plaintext highlighter-rouge">esbuild</code> rule can take a JS or TS dependency tree and bundle it to a single file, or split across multiple files, outputting a directory.</p> |
| |
| <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">load</span><span class="p">(</span><span class="s">"@npm//@bazel/esbuild:index.bzl"</span><span class="p">,</span> <span class="s">"esbuild"</span><span class="p">)</span> |
| <span class="n">load</span><span class="p">(</span><span class="s">"@npm//@bazel/typescript:index.bzl"</span><span class="p">,</span> <span class="s">"ts_library"</span><span class="p">)</span> |
| |
| <span class="n">ts_library</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"lib"</span><span class="p">,</span> |
| <span class="n">srcs</span> <span class="o">=</span> <span class="p">[</span><span class="s">"a.ts"</span><span class="p">],</span> |
| <span class="p">)</span> |
| |
| <span class="n">esbuild</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"bundle"</span><span class="p">,</span> |
| <span class="n">entry_point</span> <span class="o">=</span> <span class="s">"a.ts"</span><span class="p">,</span> |
| <span class="n">deps</span> <span class="o">=</span> <span class="p">[</span><span class="s">":lib"</span><span class="p">],</span> |
| <span class="p">)</span> |
| </code></pre></div></div> |
| |
| <p>The above will create three output files, <code class="language-plaintext highlighter-rouge">bundle.js</code>, <code class="language-plaintext highlighter-rouge">bundle.js.map</code> and <code class="language-plaintext highlighter-rouge">bundle_metadata.json</code> which contains the bundle metadata to aid in debugging and resoloution tracing.</p> |
| |
| <p>To create a code split bundle, set <code class="language-plaintext highlighter-rouge">splitting = True</code> on the <code class="language-plaintext highlighter-rouge">esbuild</code> rule.</p> |
| |
| <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">load</span><span class="p">(</span><span class="s">"@npm//@bazel/esbuild:index.bzl"</span><span class="p">,</span> <span class="s">"esbuild"</span><span class="p">)</span> |
| <span class="n">load</span><span class="p">(</span><span class="s">"@npm//@bazel/typescript:index.bzl"</span><span class="p">,</span> <span class="s">"ts_library"</span><span class="p">)</span> |
| |
| <span class="n">ts_library</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"lib"</span><span class="p">,</span> |
| <span class="n">srcs</span> <span class="o">=</span> <span class="p">[</span><span class="s">"a.ts"</span><span class="p">],</span> |
| <span class="n">deps</span> <span class="o">=</span> <span class="p">[</span> |
| <span class="s">"@npm//foo"</span><span class="p">,</span> |
| <span class="p">],</span> |
| <span class="p">)</span> |
| |
| <span class="n">esbuild</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"bundle"</span><span class="p">,</span> |
| <span class="n">entry_point</span> <span class="o">=</span> <span class="s">"a.ts"</span><span class="p">,</span> |
| <span class="n">deps</span> <span class="o">=</span> <span class="p">[</span><span class="s">":lib"</span><span class="p">],</span> |
| <span class="n">splitting</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,</span> |
| <span class="p">)</span> |
| </code></pre></div></div> |
| |
| <p>This will create an output directory containing all the code split chunks, along with their sourcemaps files</p> |
| |
| <h2 id="esbuild">esbuild</h2> |
| |
| <p><strong>USAGE</strong></p> |
| |
| <pre> |
| esbuild(<a href="#esbuild-name">name</a>, <a href="#esbuild-args">args</a>, <a href="#esbuild-define">define</a>, <a href="#esbuild-deps">deps</a>, <a href="#esbuild-entry_point">entry_point</a>, <a href="#esbuild-entry_points">entry_points</a>, <a href="#esbuild-external">external</a>, <a href="#esbuild-format">format</a>, <a href="#esbuild-launcher">launcher</a>, |
| <a href="#esbuild-link_workspace_root">link_workspace_root</a>, <a href="#esbuild-max_threads">max_threads</a>, <a href="#esbuild-minify">minify</a>, <a href="#esbuild-output">output</a>, <a href="#esbuild-output_css">output_css</a>, <a href="#esbuild-output_dir">output_dir</a>, <a href="#esbuild-output_map">output_map</a>, |
| <a href="#esbuild-platform">platform</a>, <a href="#esbuild-sourcemap">sourcemap</a>, <a href="#esbuild-sources_content">sources_content</a>, <a href="#esbuild-srcs">srcs</a>, <a href="#esbuild-target">target</a>, <a href="#esbuild-tool">tool</a>) |
| </pre> |
| |
| <p>Runs the esbuild bundler under Bazel</p> |
| |
| <p>For further information about esbuild, see https://esbuild.github.io/</p> |
| |
| <p><strong>ATTRIBUTES</strong></p> |
| |
| <h4 id="esbuild-name">name</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#name">Name</a>, mandatory</em>): A unique name for this target.</p> |
| |
| <h4 id="esbuild-args">args</h4> |
| |
| <p>(<em>List of strings</em>): A list of extra arguments that are included in the call to esbuild. |
| $(location …) can be used to resolve the path to a Bazel target.</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">[]</code></p> |
| |
| <h4 id="esbuild-define">define</h4> |
| |
| <p>(<em>List of strings</em>): A list of global identifier replacements. |
| Example:</p> |
| <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">esbuild</span><span class="p">(</span> |
| <span class="n">name</span> <span class="o">=</span> <span class="s">"bundle"</span><span class="p">,</span> |
| <span class="n">define</span> <span class="o">=</span> <span class="p">[</span> |
| <span class="s">"process.env.NODE_ENV=</span><span class="se">\"</span><span class="s">production</span><span class="se">\"</span><span class="s">"</span> |
| <span class="p">],</span> |
| <span class="p">)</span> |
| </code></pre></div></div> |
| |
| <p>See https://esbuild.github.io/api/#define for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">[]</code></p> |
| |
| <h4 id="esbuild-deps">deps</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a></em>): A list of direct dependencies that are required to build the bundle</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">[]</code></p> |
| |
| <h4 id="esbuild-entry_point">entry_point</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></em>): The bundle’s entry point (e.g. your main.js or app.js or index.js)</p> |
| |
| <p>This is a shortcut for the <code class="language-plaintext highlighter-rouge">entry_points</code> attribute with a single entry. |
| Specify either this attribute or <code class="language-plaintext highlighter-rouge">entry_point</code>, but not both.</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">None</code></p> |
| |
| <h4 id="esbuild-entry_points">entry_points</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a></em>): The bundle’s entry points (e.g. your main.js or app.js or index.js)</p> |
| |
| <p>Specify either this attribute or <code class="language-plaintext highlighter-rouge">entry_point</code>, but not both.</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">[]</code></p> |
| |
| <h4 id="esbuild-external">external</h4> |
| |
| <p>(<em>List of strings</em>): A list of module names that are treated as external and not included in the resulting bundle</p> |
| |
| <p>See https://esbuild.github.io/api/#external for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">[]</code></p> |
| |
| <h4 id="esbuild-format">format</h4> |
| |
| <p>(<em>String</em>): The output format of the bundle, defaults to iife when platform is browser |
| and cjs when platform is node. If performing code splitting or multiple entry_points are specified, defaults to esm.</p> |
| |
| <p>See https://esbuild.github.io/api/#format for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">""</code></p> |
| |
| <h4 id="esbuild-launcher">launcher</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a>, mandatory</em>): Internal use only</p> |
| |
| <h4 id="esbuild-link_workspace_root">link_workspace_root</h4> |
| |
| <p>(<em>Boolean</em>): Link the workspace root to the bin_dir to support absolute requires like ‘my_wksp/path/to/file’. |
| If source files need to be required then they can be copied to the bin_dir with copy_to_bin.</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">False</code></p> |
| |
| <h4 id="esbuild-max_threads">max_threads</h4> |
| |
| <p>(<em>Integer</em>): Sets the <code class="language-plaintext highlighter-rouge">GOMAXPROCS</code> variable to limit the number of threads that esbuild can run with. |
| This can be useful if running many esbuild rule invocations in parallel, which has the potential to cause slowdown. |
| For general use, leave this attribute unset.</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">0</code></p> |
| |
| <h4 id="esbuild-minify">minify</h4> |
| |
| <p>(<em>Boolean</em>): Minifies the bundle with the built in minification. |
| Removes whitespace, shortens identifieres and uses equivalent but shorter syntax.</p> |
| |
| <p>Sets all –minify-* flags</p> |
| |
| <p>See https://esbuild.github.io/api/#minify for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">False</code></p> |
| |
| <h4 id="esbuild-output">output</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></em>): Name of the output file when bundling</p> |
| |
| <h4 id="esbuild-output_css">output_css</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></em>): Declare a .css file will be output next to output bundle.</p> |
| |
| <p>If your JS code contains import statements that import .css files, esbuild will place the |
| content in a file next to the main output file, which you’ll need to declare. If your output |
| file is named ‘foo.js’, you should set this to ‘foo.css’.</p> |
| |
| <h4 id="esbuild-output_dir">output_dir</h4> |
| |
| <p>(<em>Boolean</em>): If true, esbuild produces an output directory containing all the output files from code splitting for multiple entry points</p> |
| |
| <p>See https://esbuild.github.io/api/#splitting and https://esbuild.github.io/api/#entry-points for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">False</code></p> |
| |
| <h4 id="esbuild-output_map">output_map</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></em>): Name of the output source map when bundling</p> |
| |
| <h4 id="esbuild-platform">platform</h4> |
| |
| <p>(<em>String</em>): The platform to bundle for.</p> |
| |
| <p>See https://esbuild.github.io/api/#platform for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">"browser"</code></p> |
| |
| <h4 id="esbuild-sourcemap">sourcemap</h4> |
| |
| <p>(<em>String</em>): Defines where sourcemaps are output and how they are included in the bundle. By default, a separate <code class="language-plaintext highlighter-rouge">.js.map</code> file is generated and referenced by the bundle. If ‘external’, a separate <code class="language-plaintext highlighter-rouge">.js.map</code> file is generated but not referenced by the bundle. If ‘inline’, a sourcemap is generated and its contents are inlined into the bundle (and no external sourcemap file is created). If ‘both’, a sourcemap is inlined and a <code class="language-plaintext highlighter-rouge">.js.map</code> file is created.</p> |
| |
| <p>See https://esbuild.github.io/api/#sourcemap for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">""</code></p> |
| |
| <h4 id="esbuild-sources_content">sources_content</h4> |
| |
| <p>(<em>Boolean</em>): If False, omits the <code class="language-plaintext highlighter-rouge">sourcesContent</code> field from generated source maps</p> |
| |
| <p>See https://esbuild.github.io/api/#sources-content for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">False</code></p> |
| |
| <h4 id="esbuild-srcs">srcs</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a></em>): Source files to be made available to esbuild</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">[]</code></p> |
| |
| <h4 id="esbuild-target">target</h4> |
| |
| <p>(<em>String</em>): Environment target (e.g. es2017, chrome58, firefox57, safari11, |
| edge16, node10, esnext). Default es2015.</p> |
| |
| <p>See https://esbuild.github.io/api/#target for more details</p> |
| |
| <p>Defaults to <code class="language-plaintext highlighter-rouge">"es2015"</code></p> |
| |
| <h4 id="esbuild-tool">tool</h4> |
| |
| <p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a>, mandatory</em>): An executable for the esbuild binary</p> |
| |
| |
| </div> |
| </div> |
| |
| <div class="col-md-2 sticky-sidebar"> |
| <div class="right-sidebar"> |
| <ul class="gh-links"> |
| <li> |
| <i class="fa fa-github"></i> |
| <a href="https://github.com/bazelbuild/rules_nodejs/issues/new?title=Documentation issue: esbuild&labels=question/docs">Create |
| issue</a> |
| </li> |
| |
| </ul> |
| <ul class="section-nav"> |
| <li class="toc-entry toc-h2"><a href="#installation">Installation</a></li> |
| <li class="toc-entry toc-h2"><a href="#esbuild">esbuild</a></li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| <footer class="footer"> |
| <div class="container"> |
| <div class="row"> |
| <div class="col-lg-8"> |
| <p class="text-muted">© 2021 The rules_nodejs authors</p> |
| </div> |
| </div> |
| </div> |
| |
| </footer> |
| |
| <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> |
| <!-- Include all compiled plugins (below), or include individual files as needed --> |
| <script crossorigin="anonymous" |
| integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" |
| src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> |
| |
| <!-- Anchor JS --> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.0/anchor.min.js" type="text/javascript"></script> |
| <script> |
| // Automatically add anchors and links to all header elements that don't already have them. |
| anchors.options = { placement: 'left' }; |
| anchors.add(); |
| </script> |
| |
| <script> |
| var shiftWindow = function () { |
| if (location.hash.length !== 0) { |
| window.scrollBy(0, -50); |
| } |
| }; |
| window.addEventListener("hashchange", shiftWindow); |
| |
| var highlightCurrentSidebarNav = function () { |
| var href = location.pathname; |
| var item = $('#sidebar-nav [href$="' + href + '"]'); |
| if (item) { |
| var li = item.parent(); |
| li.addClass("active"); |
| |
| if (li.parent() && li.parent().is("ul")) { |
| do { |
| var ul = li.parent(); |
| if (ul.hasClass("collapse")) { |
| ul.collapse("show"); |
| } |
| li = ul.parent(); |
| } while (li && li.is("li")); |
| } |
| } |
| }; |
| |
| $(document).ready(function () { |
| // Scroll to anchor of location hash, adjusted for fixed navbar. |
| window.setTimeout(function () { |
| shiftWindow(); |
| }, 1); |
| |
| // Flip the caret when submenu toggles are clicked. |
| $(".sidebar-submenu").on("show.bs.collapse", function () { |
| var toggle = $('[href$="#' + $(this).attr('id') + '"]'); |
| if (toggle) { |
| toggle.addClass("dropup"); |
| } |
| }); |
| $(".sidebar-submenu").on("hide.bs.collapse", function () { |
| var toggle = $('[href$="#' + $(this).attr('id') + '"]'); |
| if (toggle) { |
| toggle.removeClass("dropup"); |
| } |
| }); |
| |
| // Highlight the current page on the sidebar nav. |
| highlightCurrentSidebarNav(); |
| }); |
| </script> |
| |
| </body> |
| </html> |
| |