rollup-plugin-local-resolve
raw JSON → 1.0.7 verified Mon Apr 27 auth: no javascript
Resolves Node-style directory imports (e.g., `./folder` to `./folder/index.js`) in Rollup. Version 1.0.7 is the latest stable release as of 2025, with no recent updates. It is a lightweight alternative to `rollup-plugin-node-resolve` for when you only need local index.js resolution without pulling in node_modules. Does not support async, absolute paths, or custom resolve extensions.
Common errors
error Error: Cannot find module './my-folder' from '/path/to/file.js' ↓
cause Rollup doesn't resolve directory imports by default. Folder './my-folder' exists but no plugin is configured.
fix
Add rollup-plugin-local-resolve to your Rollup plugins:
plugins: [localResolve()]. error TypeError: (0 , _rollupPluginLocalResolve) is not a function ↓
cause Wrong import style (named import instead of default import) in an ES module context.
fix
Use
import localResolve from 'rollup-plugin-local-resolve' (default import). Warnings
gotcha Plugin only resolves paths relative to the current file; does not resolve node_modules. ↓
fix Use rollup-plugin-node-resolve if you need node_modules resolution.
gotcha Does not check for index.js asynchronously; may cause performance issues in large projects. ↓
fix No fix available; consider contributing async support or using an alternative.
gotcha Uses relative paths internally, inconsistent with Rollup's absolute path handling. ↓
fix Manually resolve paths to absolute if needed.
gotcha Does not support custom index file names or extensions (hardcoded to index.js). ↓
fix Use a different plugin like @rollup/plugin-node-resolve for customization.
Install
npm install rollup-plugin-local-resolve yarn add rollup-plugin-local-resolve pnpm add rollup-plugin-local-resolve Imports
- localResolve wrong
import { localResolve } from 'rollup-plugin-local-resolve'correctimport localResolve from 'rollup-plugin-local-resolve'
Quickstart
import { rollup } from 'rollup';
import localResolve from 'rollup-plugin-local-resolve';
await rollup({
input: './src/index.js',
plugins: [localResolve()]
});