# rollup-plugin-esbuild-resolve

> Use rollup with the resolution algorithm implementation of esbuild.

Latest version **1.3.1** (published 2025-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-esbuild-resolve
pnpm add rollup-plugin-esbuild-resolve
yarn add rollup-plugin-esbuild-resolve
bun add rollup-plugin-esbuild-resolve
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2025-03-25 |
| First published | 2022-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Rene Haas \| KingSora |
| Maintainers | kingsora |
| Keywords | rollup, plugin, esbuild, resolve, resolution, algorithm, node, typescript, paths, alias |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-esbuild-resolve
- Repository: https://github.com/KingSora/rollup-plugin-esbuild-resolve
- Issues: https://github.com/KingSora/rollup-plugin-esbuild-resolve/issues
- npm.io page: https://npm.io/package/rollup-plugin-esbuild-resolve

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.3.1 (latest) — 2025-03-25
- 1.3.0 — 2023-12-21
- 1.2.0 — 2022-12-09
- 1.1.1 — 2022-10-28
- 1.1.0 — 2022-10-18
- 1.0.1 — 2022-10-03
- 1.0.0 — 2022-10-03

## README

# rollup-plugin-esbuild-resolve

<a href="https://www.npmjs.com/package/rollup-plugin-esbuild-resolve">
  <img src="https://img.shields.io/npm/v/rollup-plugin-esbuild-resolve.svg?style=flat-square" alt="Version">
</a>
<a href="https://www.npmjs.com/package/rollup-plugin-esbuild-resolve">
  <img src="https://img.shields.io/npm/dm/rollup-plugin-esbuild-resolve.svg?style=flat-square" alt="Downloads">
</a>
<br /><br />

Use [rollup](https://rollupjs.org/guide/en/) with the resolution algorithm implementation of [esbuild](https://github.com/evanw/esbuild).  
This plugin replaces [`@rollup/plugin-node-resolve`](https://github.com/rollup/plugins/tree/master/packages/node-resolve) and all rollup plugins which implement the TypeScript `compilerOptions.paths` resolution algorithm.

## Why

Esbuild has its own implementation of the [node resolution algorithm](https://nodejs.org/api/modules.html#modules_all_together) and it also implements the [compilerOptions.paths resolution algorithm](https://www.typescriptlang.org/tsconfig#paths) introduced by TypeScript.

The implementation has also one speciality - its not reading just one `tsconfig.json` file, its always reading the closest one from the importer file. This enables correct resolution of many interconnected projects, each one with their own `tsconfig.json`.

## Install

```
npm i rollup-plugin-esbuild-resolve -D
```

## Usage

```js
// rollup.config.js
import { esbuildResolve } from 'rollup-plugin-esbuild-resolve';

export default {
  plugins: [
    esbuildResolve({
      // optional:
      esbuild: {
        // pass custom esbuild options here
      }
    }),
  ],
}
```

> __Note__: This plugin can be used together with `@rollup/plugin-node-resolve` and other resultion plugins.

## Options

`rollup-plugin-esbuild-resolve` has only one `optional` option:

### `esbuild`

Here you can pass custom [esbuilds build api options](https://esbuild.github.io/api/#build-api).

You can pass any options you like, but the options which are relevant for customizing the resolution algorithm are:

- [`platform`](https://esbuild.github.io/api/#platform): Customize the default values for various resolution related options.
- [`conditions`](https://esbuild.github.io/api/#conditions): Controls how the `exports` field in a `package.json` is interpreted.
- [`ignoreAnnotations`](https://esbuild.github.io/api/#ignore-annotations): Controls whether hints for side effects like the `sideEffects` field in a `package.json` or the inline `/* @__PURE__ */` comment are respected.
- [`mainFields`](https://esbuild.github.io/api/#main-fields): Controls which fields in a `package.json` are the entry point and in which order to check them.  
- [`nodePaths`](https://esbuild.github.io/api/#node-paths): Additional directories to check for modules.  
- [`preserveSymlinks`](https://esbuild.github.io/api/#preserve-symlinks): Controls whether symlinks should be preserved.
- [`resolveExtensions`](https://esbuild.github.io/api/#resolve-extensions): Controls which extensions in which order should be checked for a resolved file without extension.
- [`tsconfig`](https://esbuild.github.io/api/#tsconfig): Customize the name of the `tsconfig.json` file which should be checked.
- [`absWorkingDir`](https://esbuild.github.io/api/#working-directory): Customize the working directory.

## Corresponding `@rollup/plugin-node-resolve` options

| esbuild  | node-resolve |
| ------------- | ------------- |
| [`conditions`](https://esbuild.github.io/api/#conditions)  | [`exportConditions`](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#exportconditions)  |
| [`mainFields`](https://esbuild.github.io/api/#main-fields) | [`mainFields`](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#mainfields) |
| [`nodePaths`](https://esbuild.github.io/api/#node-paths) | [`moduleDirectories`](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#moduledirectories) / [`modulePaths`](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#modulepaths) |
| [`resolveExtensions`](https://esbuild.github.io/api/#resolve-extensions) | [`extensions`](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#extensions) |
| [`absWorkingDir`](https://esbuild.github.io/api/#working-directory) | [`rootDir`](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#rootdir) |

## License

MIT

---
_Source: https://npm.io/package/rollup-plugin-esbuild-resolve · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
