{"id":22007,"library":"rollup-plugin-esbuild-resolve","title":"rollup-plugin-esbuild-resolve","description":"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.","status":"active","version":"1.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/KingSora/rollup-plugin-esbuild-resolve","tags":["javascript","rollup","plugin","esbuild","resolve","resolution","algorithm","node","typescript"],"install":[{"cmd":"npm install rollup-plugin-esbuild-resolve","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-esbuild-resolve","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-esbuild-resolve","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: uses esbuild's resolution algorithm at runtime","package":"esbuild","optional":false},{"reason":"Peer dependency: Rollup plugin, requires Rollup v2.79.1+ / v3 / v4","package":"rollup","optional":false}],"imports":[{"note":"This package uses named export; default import is not available.","wrong":"import esbuildResolve from 'rollup-plugin-esbuild-resolve'","symbol":"esbuildResolve","correct":"import { esbuildResolve } from 'rollup-plugin-esbuild-resolve'"},{"note":"Type import only; remove at runtime.","wrong":"import { EsbuildResolveOptions } from 'rollup-plugin-esbuild-resolve'","symbol":"EsbuildResolveOptions","correct":"import type { EsbuildResolveOptions } from 'rollup-plugin-esbuild-resolve'"},{"note":"CommonJS: destructure the named export from the object.","wrong":"const esbuildResolve = require('rollup-plugin-esbuild-resolve')","symbol":"esbuildResolve (using require)","correct":"const { esbuildResolve } = require('rollup-plugin-esbuild-resolve')"}],"quickstart":{"code":"// rollup.config.js\nimport { esbuildResolve } from 'rollup-plugin-esbuild-resolve';\n\nexport default {\n  input: 'src/index.ts',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm',\n  },\n  plugins: [\n    esbuildResolve({\n      esbuild: {\n        platform: 'node',\n        resolveExtensions: ['.mjs', '.js', '.ts', '.json'],\n      },\n    }),\n  ],\n};","lang":"typescript","description":"Minimal Rollup config using esbuildResolve plugin with custom esbuild options for node platform and extended resolve extensions."},"warnings":[{"fix":"Change import to `import { esbuildResolve } from 'rollup-plugin-esbuild-resolve'`.","message":"When 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.","severity":"breaking","affected_versions":"<1.1.0"},{"fix":"Wrap esbuild-specific options in `esbuild` object: `esbuildResolve({ esbuild: { platform: 'node' } })`.","message":"Options passed directly to plugin (e.g., `esbuildResolve({ platform: 'node' })`) are deprecated since v1.2.0. Use nested `esbuild` option.","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Explicitly set the `tsconfig` option to a specific file path if you need consistent single tsconfig behavior: `esbuildResolve({ esbuild: { tsconfig: './tsconfig.json' } })`.","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure `esbuild` version ^0.19.10 and `rollup` version ^2.79.1 || ^3.0.0 || ^4.0.0 are installed.","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade Rollup to v2.79.1 or later, or use v3/v4.","message":"Support for Rollup v2 older than 2.79.1 was dropped in v1.3.0. Rollup v2.79.1 is now the minimum.","severity":"breaking","affected_versions":">=1.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install esbuild --save-dev` or `yarn add esbuild --dev`.","cause":"Missing peer dependency esbuild.","error":"Error: Cannot find module 'esbuild'"},{"fix":"Use `import { esbuildResolve } from 'rollup-plugin-esbuild-resolve'` (ESM) or `const { esbuildResolve } = require('rollup-plugin-esbuild-resolve')` (CJS).","cause":"Using default import instead of named import (or vice versa with CJS).","error":"TypeError: esbuildResolve is not a function"},{"fix":"Update `rollup-plugin-esbuild-resolve` to v1.3.0 or later.","cause":"Using an older version of the plugin that does not support Rollup v2.79.1+ properly (pre-v1.3).","error":"The plugin 'esbuildResolve' is not compatible with rollup v2.79.1 - expected a function-like plugin"},{"fix":"Check esbuild options passed to the plugin (platform, resolveExtensions, conditions). Ensure the module is installed. Optionally fallback to @rollup/plugin-node-resolve.","cause":"The plugin cannot resolve a module, likely due to incorrect esbuild options (e.g., wrong platform, missing conditions) or missing dependency.","error":"Error: esbuild's resolve API returned an error: \"Could not resolve \"some-module\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}