rollup-plugin-multi-input

raw JSON →
1.9.0 verified Mon Apr 27 auth: no javascript deprecated

Rollup plugin for bundling modular libraries with multiple entry points and glob support, preserving the source directory structure in the output. Version 1.9.0 is the latest stable release, maintained with semantic versioning and TypeScript types. It is now deprecated in favor of modular-library for Node.js >=22, and Rollup's native preserveModules is recommended otherwise. Key differentiators: glob patterns in input, relative path preservation, and transformOutputPath callback. Release cadence is irregular with features and fixes as needed.

error ERR_REQUIRE_ESM
cause Using require() on an ESM-only package (v1.4.0+).
fix
Use import multiInput from 'rollup-plugin-multi-input'; in an ES module context.
error multiInput is not a function
cause Named import { multiInput } returns undefined; misinterpreting export.
fix
Use default import: import multiInput from 'rollup-plugin-multi-input'.
error The input option cannot be specified as an object when using this plugin
cause Object inputs with glob patterns are not supported.
fix
Use string or array of strings for globs.
deprecated This plugin is deprecated. Use modular-library or Rollup's built-in preserveModules instead.
fix Migrate to modular-library (Node >=22) or use output.preserveModules: true.
breaking Package is ESM-only since v1.4.0; require() fails with ERR_REQUIRE_ESM.
fix Use import or dynamic import(). For Jest or older Node, set type: 'module' or use esm wrapper.
breaking multiInput is exported as default, not named. import { multiInput } from 'rollup-plugin-multi-input' returns undefined.
fix Use import multiInput from 'rollup-plugin-multi-input' (default import).
gotcha Object input configuration does not support glob patterns; only string/array paths support glob.
fix Use string inputs for globs, or map object values explicitly.
breaking Node.js engines >=16 required; older versions will throw at install or runtime.
fix Update Node.js to 16 or later.
npm install rollup-plugin-multi-input
yarn add rollup-plugin-multi-input
pnpm add rollup-plugin-multi-input

Configures Rollup with multi-input plugin using glob pattern, relative path, and output path transformation.

// rollup.config.js
import multiInput from 'rollup-plugin-multi-input';

export default {
  input: ['src/**/*.js'],
  output: {
    format: 'esm',
    dir: 'dist'
  },
  plugins: [
    multiInput({
      relative: 'src/',
      transformOutputPath: (output, input) => output.replace('src/', 'lib/')
    })
  ]
};