Registry / devops / rollup-plugin-merge

rollup-plugin-merge

JSON →
library0.2.1jsnpmunverified

A Rollup plugin to merge multiple JSON files into a single JSON output during the build process. Current stable version is 0.2.1, with no recent updates and a small scope. It supports recursive merging, watching for changes, and optional pretty-printing. Unlike general-purpose merge tools, it integrates directly into Rollup's plugin system. Use with caution due to infrequent maintenance.

npm install rollup-plugin-merge
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-MERG
R
rollup-plugin-merge
devopsjavascriptv0.2.1
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-merge'
const merge = require('rollup-plugin-merge')
ESM-only; does not support CommonJS require.
MergeOptions
import type { MergeOptions } from 'rollup-plugin-merge'
TypeScript users; the package does not ship types, but you can define your own for options.
rollup-plugin-merge
import merge from 'rollup-plugin-merge'
import { default as merge } from 'rollup-plugin-merge'
Default import is the only way; no named exports.

Example of merging two JSON files into a single output during Rollup build with recursive merge and prettification.

import merge from 'rollup-plugin-merge'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife', name: 'app' }, plugins: [ merge({ input: ['src/file1.json', 'src/file2.json'], output: 'dist/config.json', recursive: true, prettify: true, watch: true }) ] };
Debug
Known issues
gotchaThe 'recursive' option is misspelled as 'recurisve' in the documentation; use 'recursive' (correct spelling) in config.
fix
Use 'recursive' instead of 'recurisve' in the options object.
affects: <=0.2.1
deprecatedNo updates since 2019; may not work with latest Rollup versions (v3+).
fix
Consider alternatives like @rollup/plugin-json or manual merging.
affects: >0.2.1
gotchaPlugin uses CJS internally, but package is ESM-only; may cause issues in mixed module environments.
fix
Ensure your project is configured for ESM imports.
affects: 0.2.1
gotchaWatching ('watch' option) only copies files on start; does not trigger full rebuild.
fix
Set 'watch: true' only if you want initial copy; use Rollup's watch mode for rebuilds.
affects: 0.2.1
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Package is ESM-only, but CommonJS require() is used.
fix
Use import instead: import merge from 'rollup-plugin-merge'
TypeError: merge is not a function
Importing the plugin incorrectly (e.g., named import instead of default).
fix
Use default import: import merge from 'rollup-plugin-merge'
Plugin error: Cannot find module 'rollup-plugin-merge'
Package not installed or missing from node_modules.
fix
Run npm install rollup-plugin-merge --save-dev
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
rollupoptionalPeer dependency; the plugin is designed to work with Rollup plugin system
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-merge — npm install rollup-plugin-merge · libregistry