---
sidebar_label: esbuild
---

# tools.esbuild

- **Type:** `Object`
- **Default:** `undefined`

## Introduction

import Esbuild from '@modern-js/builder-doc/docs/en/shared/esbuild.md';

<Esbuild />

:::tip Recommend using SWC
We recommend using SWC to transform and minify code rather than esbuild, because SWC supports more syntaxes, provides better code compression, and the compiled code has better compatibility.

Therefore, we recommend that you use SWC instead of esbuild, please refer to [tools.swc](/configure/app/tools/swc) for usage.

:::

## Configuration

You can set the esbuild compilation behavior through the `tools.esbuild` config.

```js title="modern.config.ts"
import { defineConfig } from '@modern-js/app-tools';

export default defineConfig({
  tools: {
    esbuild: {
      loader: {
        target: 'chrome61',
      },
      minimize: {
        target: 'chrome61',
      },
    },
  },
});
```

For config details, please refer to [Modern.js Builder - Esbuild Plugin Configuration](https://modernjs.dev/builder/en/plugins/plugin-esbuild.html#config).
