alfredosalzillo/rollup-plugin-multi-input(opens in a new tab)
Language: JavaScript
A Rollup plugin to bundle modular libraries
- stars
- 135
- watchers
- 1
- forks
- 9
- open issues
- 2
- Last updated
- 10/21/2026
Language: JavaScript
A Rollup plugin to bundle modular libraries
⚠️ Deprecation notice
rollup-plugin-multi-inputwill be deprecated in the future. We are migrating tomodular-library.
⚠️ Do you really need rollup-plugin-multi-input?
Take a look at the rollup preserveModules and preserveModulesRoot options.
If your project uses Node.js 22 or newer, you can migrate to modular-library, which includes a Rollup plugin and can be used instead of
rollup-plugin-multi-input.
From:
import multiInput from 'rollup-plugin-multi-input'; export default { input: ['src/**/*.js'], output: { format: 'esm', dir: 'dist' }, plugins: [multiInput()], };
To:
import modularLibrary from 'modular-library/rollup'; export default { input: ['src/**/*.js'], output: { format: 'esm', dir: 'dist' }, plugins: [modularLibrary()], };
A rollup plugin to bundle modular libraries with sub directories.
src tree structure in the dist folder.Install via npm or yarn.
npm i -D rollup-plugin-multi-input yarn add rollup-plugin-multi-input
In the rollup configuration
import multiInput from 'rollup-plugin-multi-input'; export default { // use glob in the input input: ['src/**/*.js'], output: { format: 'esm', dir: 'dist' }, plugins: [ multiInput() ], };
If using a rollup version lower than 1.0.0
enable experimentalCodeSplitting.
It's possible to mix input type.
input: ['src/**/*.js']
// DO 👍 input: [{ output1: 'src/output1.js' }] // DON'T ❌ (glob not supported yet) input: [{ output1: 'src/**/*.js' }]
input: ['src/more/**/*.js', 'src/more2/**/*.js', { output1: 'src/output1.js' }]
Specify the relative path to use in the dist folder.
Example:
import multiInput from 'rollup-plugin-multi-input'; export default { input: ['src/bar.js', 'src/foo/bar.js'], output: { format: 'esm', dir: 'dist' }, plugins: [ multiInput({ relative: 'src/' }) ], }; // create the files dist/bar.js and dist/foo/bar.js
A callback for transforming output file path.
Example:
import multiInput from 'rollup-plugin-multi-input'; import path from 'path'; export default { input: ['src/bar.js', 'src/foo/bar.js'], output: { format: 'esm', dir: 'dist' }, plugins: [ multiInput({ relative: 'src/', transformOutputPath: (output, input) => `awesome/path/${path.basename(output)}`, }) ], }; // create the files awesome/path/bar.js and awesome/path/foo/bar.js
fast-glob object configuration.
Hide the build start message.