# rollup-plugin-resolve-index

> Resolves index.js files with Rollup

Latest version **0.0.5** (published 2023-07-30) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-07-30 |
| First published | 2023-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Johannes Stein |
| Maintainers | pengzai-dev |
| Keywords | rollup, rollup-plugin, resolve, folder, index |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-resolve-index
- Repository: https://github.com/pengzai-dev/rollup-plugin-resolve-index
- Homepage: https://github.com/pengzai-dev/rollup-plugin-resolve-index#readme
- Issues: https://github.com/pengzai-dev/rollup-plugin-resolve-index/issues
- npm.io page: https://npm.io/package/rollup-plugin-resolve-index

## 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

- 0.0.5 (latest) — 2023-07-30
- 0.0.4 — 2023-07-29
- 0.0.3 — 2023-07-29
- 0.0.2 — 2023-07-29
- 0.0.1 — 2023-07-29

## README

# rollup-plugin-resolve-index
Resolves Node-style directories with `index.js` files in Rollup



Rollup by default doesn't handle resolving `./folder` to `./folder/index.js/jsx` internally. While there is the `rollup-plugin-node-resolve` plugin which also resolves directories as well as all dependencies from the `node_modules` directory, these may sometimes be too much for the use case at hand.

## Installation
```
npm install --save-dev rollup-plugin-resolve-index
```

## Usage
```javascript
import { rollup } from 'rollup';
import localResolve from 'rollup-plugin-resolve-index';

// This will resolve `./files` to `./files/index.js` if the file exists
rollup({
  entry: './files',
  plugins: [localResolve()],
});
```
if you want to resolve a different file than `index.js` you can pass a `extensions` option to the plugin:
```javascript
// This will resolve `./files` to `./files/index.js` or `./files/index.jsx` if the file exists
rollup({
  entry: './files',
  plugins: [localResolve({
    extensions: ['.js', '.jsx'],
  })],
});
```

## Things to improve on
- Check for `index.js` file asynchronously
- Use absolute paths instead of relative ones to be consistent with how Rollup handles modules

## License
MIT, see `LICENSE` for more information

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