{"id":22126,"library":"rollup-plugin-merge","title":"rollup-plugin-merge","description":"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.","status":"active","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/zont/rollup-plugin-merge","tags":["javascript","rollup","plugin","rollup plugin","concat","merge","extend","file","files"],"install":[{"cmd":"npm install rollup-plugin-merge","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-merge","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-merge","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin is designed to work with Rollup plugin system","package":"rollup","optional":true}],"imports":[{"note":"ESM-only; does not support CommonJS require.","wrong":"const merge = require('rollup-plugin-merge')","symbol":"default","correct":"import merge from 'rollup-plugin-merge'"},{"note":"TypeScript users; the package does not ship types, but you can define your own for options.","symbol":"MergeOptions","correct":"import type { MergeOptions } from 'rollup-plugin-merge'"},{"note":"Default import is the only way; no named exports.","wrong":"import { default as merge } from 'rollup-plugin-merge'","symbol":"rollup-plugin-merge","correct":"import merge from 'rollup-plugin-merge'"}],"quickstart":{"code":"import merge from 'rollup-plugin-merge';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife',\n    name: 'app'\n  },\n  plugins: [\n    merge({\n      input: ['src/file1.json', 'src/file2.json'],\n      output: 'dist/config.json',\n      recursive: true,\n      prettify: true,\n      watch: true\n    })\n  ]\n};","lang":"javascript","description":"Example of merging two JSON files into a single output during Rollup build with recursive merge and prettification."},"warnings":[{"fix":"Use 'recursive' instead of 'recurisve' in the options object.","message":"The 'recursive' option is misspelled as 'recurisve' in the documentation; use 'recursive' (correct spelling) in config.","severity":"gotcha","affected_versions":"<=0.2.1"},{"fix":"Consider alternatives like @rollup/plugin-json or manual merging.","message":"No updates since 2019; may not work with latest Rollup versions (v3+).","severity":"deprecated","affected_versions":">0.2.1"},{"fix":"Ensure your project is configured for ESM imports.","message":"Plugin uses CJS internally, but package is ESM-only; may cause issues in mixed module environments.","severity":"gotcha","affected_versions":"0.2.1"},{"fix":"Set 'watch: true' only if you want initial copy; use Rollup's watch mode for rebuilds.","message":"Watching ('watch' option) only copies files on start; does not trigger full rebuild.","severity":"gotcha","affected_versions":"0.2.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import instead: import merge from 'rollup-plugin-merge'","cause":"Package is ESM-only, but CommonJS require() is used.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported."},{"fix":"Use default import: import merge from 'rollup-plugin-merge'","cause":"Importing the plugin incorrectly (e.g., named import instead of default).","error":"TypeError: merge is not a function"},{"fix":"Run npm install rollup-plugin-merge --save-dev","cause":"Package not installed or missing from node_modules.","error":"Plugin error: Cannot find module 'rollup-plugin-merge'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}