{"id":21909,"library":"rollup-merge-config","title":"rollup-merge-config","description":"Utility to merge multiple Rollup configuration objects with support for custom array and object merging strategies. Current stable version: 0.0.12 (released 2019). Low release cadence (no updates since 2019). Key differentiator: provides array concatenation and object merging specifically tailored for Rollup configs, with optional customizer functions to override default behavior for specific keys. Unlike generic merge libraries (e.g., lodash.merge), it handles Rollup's plugin arrays and nested config structures by default.","status":"maintenance","version":"0.0.12","language":"javascript","source_language":"en","source_url":"https://github.com/kjoshi1988/rollup-merge-config","tags":["javascript","rollup","merge","extend","config"],"install":[{"cmd":"npm install rollup-merge-config","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-merge-config","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-merge-config","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM only; CommonJS require will return the module object, not the merge function directly.","wrong":"const merge = require('rollup-merge-config')","symbol":"merge","correct":"import { merge } from 'rollup-merge-config'"},{"note":"Default export is an object containing merge and extend. Named exports are preferred.","wrong":"const { merge } = require('rollup-merge-config')","symbol":"default","correct":"import rollupMergeConfig from 'rollup-merge-config'"},{"note":"Identical to merge function; provided for semantic preference.","wrong":null,"symbol":"extend","correct":"import { extend } from 'rollup-merge-config'"}],"quickstart":{"code":"import { merge } from 'rollup-merge-config';\n\nconst baseConfig = {\n  input: 'src/index.js',\n  output: { file: 'dist/bundle.js', format: 'cjs' },\n  plugins: []\n};\n\nconst clientConfig = {\n  output: { file: 'dist/client.js', format: 'iife' },\n  plugins: []\n};\n\nconst serverConfig = {\n  output: { file: 'dist/server.js', format: 'cjs' },\n  plugins: []\n};\n\n// Merge multiple configs; later keys override earlier ones.\n// Arrays (like plugins) are concatenated.\nconst merged = merge(baseConfig, clientConfig, serverConfig);\nconsole.log(merged);\n// Output: {\n//   input: 'src/index.js',\n//   output: { file: 'dist/server.js', format: 'cjs' },\n//   plugins: []\n// }","lang":"javascript","description":"Shows basic merging of multiple Rollup config objects with default array concatenation and later-key override."},"warnings":[{"fix":"Use a custom arrayCustomizer to deduplicate, e.g., arrayCustomizer: (a, b, key) => key === 'plugins' ? [...new Set([...a, ...b])] : undefined","message":"Arrays are concatenated by default, not replaced. This may cause duplicate plugins if the same plugin appears in multiple configs.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure no config sets a property to undefined if you want it removed; use null instead.","message":"Properties with undefined values are not merged and are skipped. If a config explicitly sets a property to undefined, the previous value remains.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If you need to merge non-plain objects, implement a custom objectCustomizer.","message":"Deep nested objects are merged recursively, but only plain objects. Values like instances of classes or functions are replaced, not merged.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using @rollup/pluginutils mergeOptions or manually merging configs.","message":"Package has not been updated since 2019; no TypeScript definitions, no Rollup 3+ support.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import { merge } from 'rollup-merge-config' instead of const merge = require('rollup-merge-config').merge","cause":"Using default import from CommonJS require where merge is a named export.","error":"Uncaught TypeError: merge is not a function"},{"fix":"Use merge(config1, config2) or merge(...arrayOfConfigs) with spread, not merge(arrayOfConfigs).","cause":"Misunderstanding that merge can handle arrays of configs like array spread; but merge expects multiple arguments, not an array.","error":"TypeError: config.push is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}