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
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Manifest
✓ import Manifest from 'rollup-route-manifest'
✗ const Manifest = require('rollup-route-manifest')
ESM default export. CommonJS require works but TypeScript users may need esModuleInterop.
Manifest (as type)
✓ import type { RollupRouteManifestOptions } from 'rollup-route-manifest'
✗ import { ManifestOptions } from 'rollup-route-manifest'
Type exports are behind the default export; no named type exported directly.
routes function
✓ Manifest({ routes: (file) => { /* ... */ } })
✗ Manifest({ routes: {} }) without proper absolute paths
The `routes` option can be a function or an object. If object, keys must be absolute file paths.
Shows how to configure the plugin in a Rollup config, mapping absolute file paths to route patterns with the required 'routes' function.
// rollup.config.js
import Manifest from 'rollup-route-manifest';
export default {
input: 'src/index.js',
output: { dir: 'dist', format: 'esm', entryFileNames: '[name]-[hash].js', chunkFileNames: '[name]-[hash].js' },
plugins: [
Manifest({
// Map absolute file paths to route patterns
routes(file) {
// Example: group all non-page chunks as commons
if (!file.includes('/pages/')) return '*'; // commons
// Derive route from path
let name = file.replace('/Users/me/myapp/src', '').replace(/\.js$/, '');
if (name === '/pages/home') return '/';
if (name === '/pages/about') return '/about';
if (name === '/pages/blog/[slug]') return '/blog/:slug';
// Ignore error page
if (name === '/pages/error') return false;
// Default: use file path as route
return name;
},
merge: true,
minify: true
})
]
};
Errors
Common errors & fixes
TypeError: Manifest is not a function
Default import used with CommonJS requiring esModuleInterop.
fixUse `const Manifest = require('rollup-route-manifest').default;` or enable `esModuleInterop` in tsconfig. Error: [rollup-route-manifest] The `routes` option is required.
Missing `routes` option in plugin config.
fixAdd a `routes` function or object to the plugin options.
TypeError: Cannot read property 'includes' of undefined
Inside the `routes` function, the file argument is undefined because the plugin cannot retrieve the module's absolute path.
fixEnsure Rollup's preserveModules or similar options are not interfering; provide absolute paths correctly.
Audit
Dependencies
rolluprequiredpeer dependency; plugin requires Rollup >=2.0.0 API