rollup-plugin-output-manifest
raw JSON → 2.0.0 verified Mon Apr 27 auth: no javascript
Rollup plugin that generates a JSON manifest mapping source file names to their output filenames, inspired by webpack-manifest-plugin. Current stable version is 2.0.0, released with support for output assets and customizable key/value decoration. Key differentiators include flexible options for filtering, mapping, sorting bundles, and custom serialization. It is ESM-only with TypeScript type definitions. Suitable for Rollup builds requiring a manifest for asset references, unlike alternatives like @rollup/plugin-output which have different scoping.
Common errors
error SyntaxError: The requested module 'rollup-plugin-output-manifest' does not provide an export named 'default' ↓
cause Using CommonJS require() instead of ESM import.
fix
Switch to ESM or use dynamic import: import('rollup-plugin-output-manifest').then(m => m.default()).
error TypeError: outputManifest is not a function ↓
cause Named import instead of default import.
fix
Use import outputManifest from 'rollup-plugin-output-manifest' (without braces).
error Error: The plugin 'output-manifest' tried to add a file that already exists: manifest.json ↓
cause Two plugin instances with same fileName or conflict with another plugin.
fix
Set fileName to a unique value or enable isMerge: true.
Warnings
breaking In v2.0.0, the default filter now includes OutputAsset by default. Previous behavior filtered only OutputChunk. ↓
fix If you relied on exclusion of assets, provide a custom filter: outputManifest({ filter: bundle => bundle.type === 'chunk' })
breaking In v2.0.0, default import is required. Named exports are not available. ↓
fix Use default import: import outputManifest from 'rollup-plugin-output-manifest'
gotcha The plugin modifies Rollup's output hit map by writing manifest.json as an asset; conflicts if another plugin writes to same filename. ↓
fix Ensure fileName option is unique or set isMerge to true to append entries.
deprecated Option nameWithExt default changed from false to true in a minor version; the README shows true as default but may be misleading. ↓
fix Check your config: if you need keys without extension, set nameWithExt: false.
Install
npm install rollup-plugin-output-manifest yarn add rollup-plugin-output-manifest pnpm add rollup-plugin-output-manifest Imports
- outputManifest wrong
import { outputManifest } from 'rollup-plugin-output-manifest'correctimport outputManifest from 'rollup-plugin-output-manifest' - outputManifest (default export) wrong
const outputManifest = require('rollup-plugin-output-manifest')correctimport outputManifest from 'rollup-plugin-output-manifest' - type OutputManifestOptions wrong
import { OutputManifestOptions } from 'rollup-plugin-output-manifest'correctimport type { OutputManifestOptions } from 'rollup-plugin-output-manifest'
Quickstart
import outputManifest from 'rollup-plugin-output-manifest';
export default {
input: 'src/index.js',
output: {
dir: 'dist',
format: 'esm',
},
plugins: [
outputManifest({
fileName: 'manifest.json',
publicPath: '/assets/',
isMerge: false,
}),
],
};