Registry / devops / esbuild-plugin-json-merge

esbuild-plugin-json-merge

JSON →
library0.1.0jsnpmunverified

esbuild plugin to merge multiple JSON sources (glob patterns or inline objects) into a single output file during the build process. Version 0.1.0 is stable with no recent updates; it uses deep merging via Object.assign by default and supports custom merge functions. Differentiators: seamless integration with esbuild's pipeline, supports globs and inline objects, optional custom merge logic. Ships TypeScript types with MIT license. Ideal for bundling manifest files or configuration JSONs.

npm install esbuild-plugin-json-merge
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-JSO
E
esbuild-plugin-json-merge
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

jsonMerge
import jsonMerge from 'esbuild-plugin-json-merge'
const jsonMerge = require('esbuild-plugin-json-merge')
ESM uses default export; CJS require works if using CommonJS. TypeScript supports both.
jsonMerge
const jsonMerge = require('esbuild-plugin-json-merge').default
const jsonMerge = require('esbuild-plugin-json-merge')
In CJS (require), default is on .default to avoid CommonJS interop issues.
JsonMergeOptions
import type { JsonMergeOptions } from 'esbuild-plugin-json-merge'
import { JsonMergeOptions } from 'esbuild-plugin-json-merge'
Types are exported but only for TypeScript type usage; not runtime.

Compiles an esbuild build that merges a file and inline object into a single JSON output.

import esbuild from 'esbuild'; import jsonMerge from 'esbuild-plugin-json-merge'; const { version, name, description } = { version: '1.0.0', name: 'my-app', description: 'Example app' }; await esbuild.build({ entryPoints: ['src/index.js'], outdir: 'dist', plugins: [ jsonMerge({ entryPoints: ['src/manifest.json', { version, name, description }], outfile: 'manifest.json', }), ], });
Debug
Known issues
gotchaDefault merge uses shallow Object.assign; nested objects overwrite instead of deep merge.
fix
Provide a custom merge function, e.g., using default-composer or lodash.merge.
affects: >=0.1.0
gotchaentryPoints accepts glob patterns; ensure globs match expected files to avoid missing data.
fix
Test glob patterns with glob package directly if issues arise.
affects: >=0.1.0
breakingLibrary switched to ESM-only? Check usage if using older Node versions without ESM support.
fix
Use dynamic import() in Node <12, or configure bundler for CommonJS.
affects: >=0.1.0
gotchaoutfile path is relative to esbuild's outdir; not the project root by default.
fix
Set outfile relative to outdir, or adjust esbuild's working directory.
affects: >=0.1.0
deprecatedVersion 0.1.0 has no known deprecations yet; this is a placeholder for future.
fix
Monitor releases for updates.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Could not resolve 'esbuild-plugin-json-merge'
Package not installed or missing from node_modules.
fix
Run 'npm install esbuild-plugin-json-merge --save-dev'.
TypeError: jsonMerge is not a function
Using default import in CJS without calling .default.
fix
Use 'const jsonMerge = require('esbuild-plugin-json-merge').default' or switch to ESM import.
Error: [esbuild] Must use '--entry-names' or similar? No, this error arises from misconfiguration.
Plugin options incorrectly passed or missing required fields.
fix
Ensure entryPoints is an array of strings/objects and outfile is a string.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency; plugin integrates with esbuild
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-json-merge — npm install esbuild-plugin-json-merge · libregistry