Registry /
devops / esbuild-manifest-plugin
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.
default
✓ const manifestPlugin = require('esbuild-manifest-plugin')
✗ const manifestPlugin = require('esbuild-manifest-plugin').default
Package exports a function directly, not as default export. Use require() as shown.
manifestPlugin
✓ import manifestPlugin from 'esbuild-manifest-plugin'
✗ import { default as manifestPlugin } from 'esbuild-manifest-plugin'
ESM default import works because the package uses module.exports = function. This is the preferred way for ESM projects.
ManifestPluginOptions
✓ type ManifestPluginOptions = Parameters<typeof manifestPlugin>[0]
✗ import { ManifestPluginOptions } from 'esbuild-manifest-plugin'
No types are exported. Infer types or define manually. The plugin is JavaScript-only without TypeScript definitions.
Build an entry point and generate a manifest.json with content-hashed filenames. The plugin automatically enables metafile.
const esbuild = require('esbuild');
const manifestPlugin = require('esbuild-manifest-plugin');
const path = require('path');
esbuild.build({
entryPoints: ['application.js'],
entryNames: '[dir]/[name]-[hash]',
assetNames: '[dir]/[name]-[hash]',
bundle: true,
outdir: path.join(__dirname, 'public/assets'),
plugins: [manifestPlugin()]
}).then(() => {
console.log('Build complete. Manifest written to outdir.');
}).catch(() => process.exit(1));
Debug
Known issues
gotchaThe plugin automatically enables the 'metafile' option in esbuild if not already set. This may cause unexpected metafile output size for large builds.fixEnsure your build has enough memory or explicitly disable metafile if you don't need it (but then the plugin will enable it anyway).
affects: >=1.0.0
gotchanodeModulesPrefix default is empty string, which rewrites node_modules paths to be relative without prefix (e.g., 'example-lib/image.png'). This may collide with your own asset paths if you have files with the same names.fixSet nodeModulesPrefix to '~' or false to avoid collisions. Review generated manifest for duplicates.
affects: >=1.0.0
deprecatedNo deprecations yet as plugin is v1.0.0.
breakingNo breaking changes reported yet.
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-manifest-plugin'
Package not installed or not in node_modules.
fixRun 'npm install -D esbuild-manifest-plugin' to install it.
TypeError: manifestPlugin is not a function
Incorrect import: using default import from CommonJS module.
fixUse 'const manifestPlugin = require('esbuild-manifest-plugin');' Error: The plugin "esbuild-manifest-plugin" requires the "metafile" option
If user explicitly set metafile: false, plugin reports error (though code says it auto-enables). Actually the plugin always forces metafile true, but if esbuild refuses, this may appear.
fixRemove 'metafile: false' from your esbuild config.
Error: Build failed with 1 error: error: [plugin: esbuild-manifest-plugin] Manifest generation failed
Internal error in plugin, possibly due to missing outdir or write permissions.
fixEnsure outdir exists and is writable. Check esbuild logs for preceding errors.
Audit
Dependencies
esbuildrequiredpeer dependency required for plugin to work