rollup-plugin-concat
raw JSON → 1.0.4 verified Mon Apr 27 auth: no javascript maintenance
A Rollup plugin that concatenates files into single output files during the buildStart hook, making them available for import by other plugins. Version 1.0.4 is stable but has no recent updates (last release likely pre-2020). Key differentiator: integrates directly into Rollup's build pipeline with grouped file configurations. Alternative to manual concatenation or separate build steps.
Common errors
error Error: Cannot find module 'rollup-plugin-concat' ↓
cause Package not installed or import path incorrect.
fix
Run: npm install rollup-plugin-concat --save-dev
error TypeError: concat is not a function ↓
cause Imported as named export instead of default.
fix
Use: import concat from 'rollup-plugin-concat'
error [!] (plugin concat) Error: groupedFiles must be an array ↓
cause Options object missing groupedFiles or not an array.
fix
Provide options as { groupedFiles: [ {...} ] }
Warnings
gotcha Plugin only runs on buildStart hook; output files are generated before subsequent plugins run, but are not watched for changes. ↓
fix Ensure that concatenated files are static or trigger a rebuild manually if they change.
gotcha Output file paths are relative to the current working directory, not relative to the Rollup config file. ↓
fix Use absolute paths or resolve relative to __dirname.
deprecated The package has not been updated in several years; may not work with Rollup 3+ due to hook changes. ↓
fix Consider using @rollup/plugin-multi-entry or manual concatenation scripts.
Install
npm install rollup-plugin-concat yarn add rollup-plugin-concat pnpm add rollup-plugin-concat Imports
- concat wrong
const concat = require('rollup-plugin-concat')correctimport concat from 'rollup-plugin-concat' - default export wrong
import { concat } from 'rollup-plugin-concat'correctimport concat from 'rollup-plugin-concat'
Quickstart
import concat from 'rollup-plugin-concat';
export default {
input: 'src/index.js',
output: {
file: 'bundle.js',
format: 'esm'
},
plugins: [
concat({
groupedFiles: [
{
files: ['./fileA.js', './fileB.js'],
outputFile: './ab.js'
}
]
})
]
};