Registry / devops / rollup-plugin-import-folder

rollup-plugin-import-folder

JSON →
library1.0.6jsnpmunverified

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-folder
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-IMPO
R
rollup-plugin-import-folder
devopsjavascriptv1.0.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import folder from 'rollup-plugin-import-folder'
const folder = require('rollup-plugin-import-folder')
Default export; CommonJS require works but ESM is recommended since Node >=16. Package ships types.
folder
import folder from 'rollup-plugin-import-folder'
import { folder } from 'rollup-plugin-import-folder'
Named import 'folder' is incorrect; only default export exists.
Plugin
import type { Plugin } from 'rollup'
import { Plugin } from 'rollup-plugin-import-folder'
Plugin type is imported from Rollup, not this package. This package types are 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.

// rollup.config.js import folder from 'rollup-plugin-import-folder'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'esm' }, plugins: [folder()] }; // src/index.js import './hello-world'; // resolves to ./hello-world/hello-world.js // src/hello-world/hello-world.js export const message = 'Hello World!';
Debug
Known issues
deprecatedPlugin options `include` and `exclude` are deprecated since v1.0.5
fix
Remove include/exclude options; they are no longer needed as the plugin always resolves folder imports.
affects: >=1.0.5
gotchaImport path must match folder name exactly; case-sensitive on some file systems
fix
Verify folder name and import path casing, especially on Linux/macOS.
affects: >=1.0.0
gotchaPlugin does not support dynamic imports (import())
fix
Use static imports for folder resolution; dynamic imports will remain unchanged.
affects: >=1.0.0
gotchaResolves only .js and .mjs files; other extensions like .ts or .jsx are ignored unless configured via Rollup's resolve plugin
fix
Ensure that files inside folders have .js or .mjs extensions, or use @rollup/plugin-typescript or @rollup/plugin-babel for other extensions.
affects: >=1.0.0
gotchaPlugin works only with relative imports starting with './' or '../'
fix
Absolute imports or bare specifiers are not processed; use relative paths for folder resolution.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Could not resolve './hello-world' from src/index.js
Folder does not contain a file named hello-world.js or the import path is incorrect.
fix
Create src/hello-world/hello-world.js with a default or named export, or check the folder name spelling.
TypeError: folder is not a function
The plugin is imported incorrectly (e.g., using named import instead of default).
fix
Use `import folder from 'rollup-plugin-import-folder'` (default import).
[!] (plugin rpt2) RollupError: Could not resolve entry module
Plugin version incompatible with Rollup v4; plugin uses dynamic require which is not allowed.
fix
Update rollup-plugin-import-folder to latest version (>=1.0.6) or use older Rollup (<4).
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
rolluprequiredPeer dependency required for Rollup plugin integration
Agent activity
5 hits · last 30 days
node
4
Resources
rollup-plugin-import-folder — npm install rollup-plugin-import-folder · libregistry