Registry / devops / rollup-route-manifest

rollup-route-manifest

JSON →
library1.0.0jsnpmunverified

Rollup plugin (v1.0.0, stable, low release cadence) that generates an asset manifest keyed by route patterns, enabling proactive prefetching/preloading of code-split chunks. Unlike generic manifest plugins, this maps output filenames to URL route patterns via a user-defined function or dictionary, giving control over commons grouping and route-specific asset lists. Ships TypeScript types, requires Rollup >=2.0.0.

npm install rollup-route-manifest
INSTALL
IMPORT
SIG · ROLLUP-ROUTE-MANIF
R
rollup-route-manifest
devopsjavascriptv1.0.0
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.

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 }) ] };
Debug
Known issues
breakingThe `routes` option is required and must be a function or an object with absolute paths as keys. If missing, the plugin throws an error.
fix
Always provide a `routes` option as described in the docs.
affects: >=1.0.0
gotchaWhen using the object form of `routes`, keys must be absolute file paths exactly as resolved by Rollup (including platform-specific separators).
fix
Use `path.resolve` to generate the keys or extract absolute paths from Rollup's module resolution.
affects: >=1.0.0
gotchaReturning `false` from the `routes` function does NOT prevent the chunk from being emitted; it only omits it from the manifest. The chunk will still appear in the bundle output.
fix
If you want to exclude a chunk entirely, use Rollup's `inlineDynamicImports` or other mechanisms.
affects: >=1.0.0
gotchaThe manifest output file is written to the Rollup output directory as `route-manifest.json` by default. Ensure the output directory is writable and not already containing that file unless you want it overwritten.
fix
Use the `name` option to customize the manifest filename if needed.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Manifest is not a function
Default import used with CommonJS requiring esModuleInterop.
fix
Use `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.
fix
Add 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.
fix
Ensure Rollup's preserveModules or similar options are not interfering; provide absolute paths correctly.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency; plugin requires Rollup >=2.0.0 API
Agent activity
2 hits · last 30 days
node
2
Resources
rollup-route-manifest — npm install rollup-route-manifest · libregistry