Registry /
devops / rollup-plugin-json-combine
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import jsonCombine from 'rollup-plugin-json-combine'
✗ const jsonCombine = require('rollup-plugin-json-combine')
Package is ESM-only due to Rollup plugin conventions. Default export is the plugin function.
RollupPluginJsonCombineOptions
✓ import type { RollupPluginJsonCombineOptions } from 'rollup-plugin-json-combine'
TypeScript type for plugin options, available only when using TypeScript.
MergeCallback
✓ import type { MergeCallback } from 'rollup-plugin-json-combine'
TypeScript type for the merge callback function signature.
Combines all JSON files in locales/ into a single dist/locales.json with keys derived from file names.
import jsonCombine from 'rollup-plugin-json-combine';
export default {
input: 'src/index.js',
output: {
file: 'dist/bundle.js',
format: 'esm'
},
plugins: [
jsonCombine({
input: ['locales/*.json'],
fileName: 'dist/locales.json',
merge: (items) => {
const output = {};
items.forEach((item) => {
output[item.name.replace('.json', '')] = item.res;
});
return output;
},
}),
],
};
Debug
Known issues
gotchaThe merge callback receives items as an array of { name, res } where 'res' is a string (raw content), not a parsed JSON object.fixIf you need the parsed value, call JSON.parse(item.res) inside the merge callback.
affects: >=1.0.0
breakingInput option must be an array of glob patterns. Providing a single string (e.g., 'path/*.json') is not supported and may cause no files to be matched.fixAlways pass an array: ['path/*.json']
affects: >=1.0.0
gotchaThe fileName option is required and must be relative to your Rollup output directory, not the project root.fixEnsure the path in fileName is correct relative to your output directory. For example, if output.file is 'dist/bundle.js', use 'dist/locales.json'.
affects: >=1.0.0
deprecatedNo known deprecations in current version.
Errors
Common errors & fixes
Error: No files matched for input pattern: path/*.json
Input pattern does not match any files or the path is incorrect relative to the project root.
fixVerify the pattern is correct and files exist. Use absolute paths or correct relative paths from process.cwd().
TypeError: items.forEach is not a function
The merge callback is called with undefined or non-array data, possibly because input pattern matched no files.
fixEnsure at least one JSON file matches the input pattern. Add error handling in the merge callback.
Error: [plugin: json-combine] Cannot read properties of undefined (reading 'forEach')
Same as above; merge callback receives undefined when no files are matched.
fixCheck the input pattern and file existence.
Audit
Dependencies
No dependency data recorded yet.