A Vite plugin (v1.4.5) that generates a directory listing index page during development. Ideal for projects with multiple HTML entry points: it scans the base directory, filters common files (node_modules, .env, etc.), and injects the listing into a template using the {%DIRECTORY%} tag. Only active in serve mode; no-op on build. Minimal configuration: requires baseDir and optional filterList. Unlike general-purpose directory listing tools, it integrates seamlessly with Vite's dev server, allowing you to click through HTML files that are compiled on-the-fly. Maintained by Wes Bos, updated irregularly.
npm install vite-plugin-list-directory-contentsVerified import paths — ran on the pinned version, not inferred.
Basic setup: import the plugin, pass baseDir, and use it in Vite config. The plugin will create an index.html with {%DIRECTORY%} tag.
No fix needed; it's by design. If you need directory listing in production, consider other solutions.
If you set a filterList, include all files you want to filter; defaults are not merged.
Ensure you have no custom index.html you want to preserve, or modify the template carefully.
Run only on trusted networks or use Vite's server.host to restrict access.
Change to: import { directoryPlugin } from 'vite-plugin-list-directory-contents'Add baseDir: __dirname (or your desired path) to the plugin options.