Registry / devops / rollup-plugin-esbuild-resolve

rollup-plugin-esbuild-resolve

JSON →
library1.3.1jsnpmunverified

A Rollup plugin that replaces @rollup/plugin-node-resolve and TypeScript paths resolution plugins with esbuild's own resolution algorithm. Version 1.3.1 is current and stable, with infrequent releases. It reads the closest tsconfig.json from each importer, enabling correct resolution across multiple interconnected projects with their own tsconfig files. Supports all esbuild resolution options (platform, conditions, mainFields, etc.) and works alongside other resolve plugins. Ships TypeScript types.

npm install rollup-plugin-esbuild-resolve
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-ESBU
R
rollup-plugin-esbuild-resolve
devopsjavascriptv1.3.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

esbuildResolve
✓ import { esbuildResolve } from 'rollup-plugin-esbuild-resolve'
✗ import esbuildResolve from 'rollup-plugin-esbuild-resolve'
This package uses named export; default import is not available.
EsbuildResolveOptions
✓ import type { EsbuildResolveOptions } from 'rollup-plugin-esbuild-resolve'
✗ import { EsbuildResolveOptions } from 'rollup-plugin-esbuild-resolve'
Type import only; remove at runtime.
esbuildResolve (using require)
✓ const { esbuildResolve } = require('rollup-plugin-esbuild-resolve')
✗ const esbuildResolve = require('rollup-plugin-esbuild-resolve')
CommonJS: destructure the named export from the object.

Minimal Rollup config using esbuildResolve plugin with custom esbuild options for node platform and extended resolve extensions.

// rollup.config.js import { esbuildResolve } from 'rollup-plugin-esbuild-resolve'; export default { input: 'src/index.ts', output: { file: 'dist/bundle.js', format: 'esm', }, plugins: [ esbuildResolve({ esbuild: { platform: 'node', resolveExtensions: ['.mjs', '.js', '.ts', '.json'], }, }), ], };
Debug
Known issues
breakingWhen upgrading from v1.0 to v1.1, the plugin switched to named export `esbuildResolve` instead of default export. Old code using `import esbuildResolve from 'rollup-plugin-esbuild-resolve'` will break.
fix
Change import to `import { esbuildResolve } from 'rollup-plugin-esbuild-resolve'`.
affects: <1.1.0
deprecatedOptions passed directly to plugin (e.g., `esbuildResolve({ platform: 'node' })`) are deprecated since v1.2.0. Use nested `esbuild` option.
fix
Wrap esbuild-specific options in `esbuild` object: `esbuildResolve({ esbuild: { platform: 'node' } })`.
affects: >=1.2.0
gotchaThe plugin reads the closest `tsconfig.json` from each importer file, not from the project root. This may produce different resolution results compared to TypeScript's default behavior which reads the root `tsconfig.json`. Works as intended for monorepos, but can surprise users expecting single root tsconfig behavior.
fix
Explicitly set the `tsconfig` option to a specific file path if you need consistent single tsconfig behavior: `esbuildResolve({ esbuild: { tsconfig: './tsconfig.json' } })`.
affects: all
gotchaThe plugin requires both `esbuild` and `rollup` as peer dependencies. Using an incompatible version of either (e.g., esbuild <0.19.10 or rollup <2.79.1) will cause errors or undefined behavior.
fix
Ensure `esbuild` version ^0.19.10 and `rollup` version ^2.79.1 || ^3.0.0 || ^4.0.0 are installed.
affects: all
breakingSupport for Rollup v2 older than 2.79.1 was dropped in v1.3.0. Rollup v2.79.1 is now the minimum.
fix
Upgrade Rollup to v2.79.1 or later, or use v3/v4.
affects: >=1.3.0
Errors
Common errors & fixes
Error: Cannot find module 'esbuild'
Missing peer dependency esbuild.
fix
Run `npm install esbuild --save-dev` or `yarn add esbuild --dev`.
TypeError: esbuildResolve is not a function
Using default import instead of named import (or vice versa with CJS).
fix
Use `import { esbuildResolve } from 'rollup-plugin-esbuild-resolve'` (ESM) or `const { esbuildResolve } = require('rollup-plugin-esbuild-resolve')` (CJS).
The plugin 'esbuildResolve' is not compatible with rollup v2.79.1 - expected a function-like plugin
Using an older version of the plugin that does not support Rollup v2.79.1+ properly (pre-v1.3).
fix
Update `rollup-plugin-esbuild-resolve` to v1.3.0 or later.
Error: esbuild's resolve API returned an error: "Could not resolve "some-module"
The plugin cannot resolve a module, likely due to incorrect esbuild options (e.g., wrong platform, missing conditions) or missing dependency.
fix
Check esbuild options passed to the plugin (platform, resolveExtensions, conditions). Ensure the module is installed. Optionally fallback to @rollup/plugin-node-resolve.
Upgrade
Version history
1.3.1latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency: uses esbuild's resolution algorithm at runtime
rolluprequiredPeer dependency: Rollup plugin, requires Rollup v2.79.1+ / v3 / v4
Agent activity
10 hits · last 30 days
node
8
Resources
rollup-plugin-esbuild-resolve — npm install rollup-plugin-esbuild-resolve · libregistry