Registry / devops / rollup-plugin-json-merge

rollup-plugin-json-merge

JSON →
library0.0.2jsnpmunverified

A Rollup plugin (v0.0.2, stable but minimal) that merges multiple JSON sources into one output file during bundle build. Supports glob patterns, inline objects, and custom merge functions. Lightweight alternative to manual JSON combination in Rollup pipelines. No major updates since initial release; less feature-rich than @rollup/plugin-json combined with manual merging but simpler for single-file concatenation.

npm install rollup-plugin-json-merge
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-JSON
R
rollup-plugin-json-merge
devopsjavascriptv0.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import merge from 'rollup-plugin-json-merge'
const merge = require('rollup-plugin-json-merge')
ESM-only package; use import syntax or dynamic import().
merge
import merge from 'rollup-plugin-json-merge'
import { merge } from 'rollup-plugin-json-merge'
Package exports a default function only, not a named export.
type Plugin
import type { Plugin } from 'rollup'
type Plugin = { ... }
TypeScript users should import Rollup's Plugin type separately; this package does not export types.

Minimal Rollup config that merges two JSON files into one output using the plugin.

import merge from 'rollup-plugin-json-merge'; export default { input: 'src/index.js', output: { dir: 'output', format: 'cjs' }, plugins: [ merge({ input: ['src/part1.json', 'src/part2.json'], fileName: 'combined.json', }), ], };
Debug
Known issues
gotchaPlugin may not handle conflicting keys across input files; uses shallow assign by default.
fix
Provide custom merge function via options.merge to handle conflicts (e.g., deep merge).
affects: 0.x
gotchaGlob patterns in input must resolve to absolute paths or relative to process.cwd(); no automatic resolution.
fix
Use path.resolve or ensure patterns are correct relative to working directory.
affects: 0.x
gotchaPlugin does not emit warnings for non-existent files; silent failure if no files matched.
fix
Validate input files exist before configuring plugin.
affects: 0.x
Errors
Common errors & fixes
Error: Cannot find module 'glob'
Missing glob peer dependency.
fix
npm install glob --save-dev
TypeError: merge is not a function
Using named import incorrectly.
fix
Use default import: import merge from 'rollup-plugin-json-merge'
Error: Could not resolve 'rollup-plugin-json-merge'
Package not installed.
fix
npm install rollup-plugin-json-merge --save-dev
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
globrequiredUsed for file pattern matching in input configuration
rolluprequiredPeer dependency as a Rollup plugin
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-json-merge — npm install rollup-plugin-json-merge · libregistry