Registry / devops / rollup-plugin-includepaths

rollup-plugin-includepaths

JSON →
library0.2.4jsnpmunverified

A Rollup plugin that allows importing modules using relative paths from configured base directories. Version 0.2.4 is the latest stable release (August 2020), with no further updates expected. It helps avoid deep relative imports by defining alias paths, similar to Webpack's resolve.alias. Unlike @rollup/plugin-alias, this plugin supports multiple path prefixes and automatic file extension resolution. Lightweight with no runtime dependencies, but unmaintained since 2020.

npm install rollup-plugin-includepaths
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-INCL
R
rollup-plugin-includepaths
devopsjavascriptv0.2.4
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.

includePaths
import includePaths from 'rollup-plugin-includepaths';
const includePaths = require('rollup-plugin-includepaths');
Default import; commonJS require works but Babel may be needed for interop.
options
import includePaths from 'rollup-plugin-includepaths'; const options = { paths: ['src/lib'] };
Options object is not exported; it's the argument to the default function.

Configures Rollup to resolve imports relative to 'src/lib' and 'src/other', allowing short paths like 'one/foo'.

// rollup.config.js import includePaths from 'rollup-plugin-includepaths'; export default { input: 'src/main.js', output: { file: 'dist/bundle.js', format: 'cjs' }, plugins: [ includePaths({ paths: ['src/lib', 'src/other'], external: [], extensions: ['.js', '.json', '.html'] }) ] }; // Now in any file inside src/lib or src/other, use: // import { Foo } from 'one/foo'; // resolves to src/lib/one/foo.js or src/other/one/foo.js
Debug
Known issues
deprecatedNo updates since 2020; consider using @rollup/plugin-alias for active maintenance.
fix
Migrate to '@rollup/plugin-alias' with similar configuration.
affects: >=0.2.4
gotchaIf no paths option is given, the plugin resolves from the current working directory, which may cause unexpected matches.
fix
Always specify an explicit paths array in options.
affects: >=0.1.0
gotchaThe plugin does not handle node_modules by default; it only looks in the provided paths.
fix
Use @rollup/plugin-node-resolve alongside this plugin for node_modules resolution.
affects: >=0.1.0
breakingVersion 0.2.0 dropped support for Node.js <6; may break on older runtimes.
fix
Upgrade Node.js to >=6 or stick with 0.1.x.
affects: >=0.2.0
Errors
Common errors & fixes
Error: Could not resolve 'someModule' from '...'
The module name is not found in any of the configured paths or the include map.
fix
Add the module path to the 'paths' array or use 'include' option with explicit file path.
TypeError: includePaths is not a function
Using import incorrectly, e.g., 'import { includePaths } from 'rollup-plugin-includepaths''
fix
Use default import: 'import includePaths from 'rollup-plugin-includepaths''
Error: Cannot find module 'rollup-plugin-includepaths'
Plugin not installed or package missing from node_modules.
fix
Run 'npm install rollup-plugin-includepaths --save-dev'
Upgrade
Version history
0.2.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-includepaths — npm install rollup-plugin-includepaths · libregistry