A Rollup plugin (or plugin helper) that allows applying Rollup plugins conditionally based on output options (format, file, etc.). Version 1.0.1 is the latest stable release. It helps reduce duplicate config when Rollup has multiple outputs that need different plugins (e.g., minification only for UMD builds). Key differentiator: provides elegant helpers like `when`, `whenAll`, `prop`, `format`, and `file` to filter plugins per output. Unlike manual array configs, it keeps code DRY. Requires Node >=8.3.0.
npm install rollup-plugin-by-outputVerified import paths — ran on the pinned version, not inferred.
Applies babel to all outputs and terser only to the minified output.
Use when(file.name => name.endsWith('.min.js'), plugin) or prop('file', f => f.endsWith('.min.js'))Be explicit: import plugins, { when } from 'rollup-plugin-by-output'Call plugins() with arguments: plugins(pluginA, [filter, pluginB]). Do not wrap in array brackets.
Ensure your bundler supports ESM or use import { when } from 'rollup-plugin-by-output' with ES modules; in CJS, use const { when } = require('rollup-plugin-by-output').Run npm install --save-dev rollup-plugin-by-output