# vite-plugin-auto-index

> Automatically generate and update an index.js file in each specified path

Latest version **1.0.1** (published 2023-05-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install vite-plugin-auto-index
pnpm add vite-plugin-auto-index
yarn add vite-plugin-auto-index
bun add vite-plugin-auto-index
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-05-18 |
| First published | 2023-05-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Dan Storey |
| Maintainers | leviat-tech-studio |
| Keywords | vite, vite-plugin |

## Links

- npm: https://www.npmjs.com/package/vite-plugin-auto-index
- Repository: https://github.com/leviat-tech/vite-plugin-auto-index
- Homepage: https://github.com/leviat-tech/vite-plugin-auto-index#readme
- Issues: https://github.com/leviat-tech/vite-plugin-auto-index/issues
- npm.io page: https://npm.io/package/vite-plugin-auto-index

## Dependencies (1)

- [glob](https://npm.io/package/glob.md) ^10.2.5

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-05-18
- 1.0.0 — 2023-05-18

## README

# vite-plugin-auto-index

This Vite Plugin automatically generates an `index.js` file in each of the specified paths which exports all modules contained within the folder.

Index files are generated on initial build/dev and each time a file is added or removed from the specified paths.

## usage

```javascript
// vite.config.js
import autoIndex from 'vite-plugin-auto-index'

export default {
  plugins: [
    autoIndex([
      {
        path: 'path/to/modules',
        includeSubfolders: false, // optional
        includeExtension: false, // optional
        ignore: '/exclude/**' // optional
      }
    ])
  ],
}
```

## options

Each path config item can be configured with the following options:

### `path`

Required

Type: `string` 

The relative path in which to scan for files and the destination path for the generated `index.js` file

### `includeSubfolders`

Type `boolean`

Default: `false`

Whether to recurse subfolders for modules to add to the index file

### `includeExtension`

Type `boolean`

Default: `false`

Whether to include the file extension when importing files in the index file

### `ignore`

Type `string | array`

A glob pattern or array of patterns, which specifies the files to be excluded from the index file

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