A Rollup plugin that resolves imports using folder names instead of explicit file paths. It transforms import statements like `import './hello-world'` into `import './hello-world/hello-world.js'`, making modular component-based projects easier to manage by eliminating the need for index.js files. Version 1.0.6 is stable and maintained, supporting Rollup versions 1.x through 4.x. It is published on npm and aimed at developers using bundlers for JavaScript or TypeScript projects. The plugin ships with TypeScript definitions and is configured with include/exclude options. It is a lightweight utility solution for teams organizing components in folders.
npm install rollup-plugin-import-folderVerified import paths — ran on the pinned version, not inferred.
Basic usage showing how to import and configure the plugin in a Rollup config, along with an example of how folder imports are resolved.
Remove include/exclude options; they are no longer needed as the plugin always resolves folder imports.
Verify folder name and import path casing, especially on Linux/macOS.
Use static imports for folder resolution; dynamic imports will remain unchanged.
Ensure that files inside folders have .js or .mjs extensions, or use @rollup/plugin-typescript or @rollup/plugin-babel for other extensions.
Absolute imports or bare specifiers are not processed; use relative paths for folder resolution.
Create src/hello-world/hello-world.js with a default or named export, or check the folder name spelling.
Use `import folder from 'rollup-plugin-import-folder'` (default import).
Update rollup-plugin-import-folder to latest version (>=1.0.6) or use older Rollup (<4).