Registry / devops / esbuild-plugin-assets-manifest

esbuild-plugin-assets-manifest

JSON →
library1.0.8jsnpmunverified

esbuild plugin that generates a JSON manifest file mapping entry points to their output assets (JS, CSS, images, etc.), similar to assets-webpack-plugin for Webpack. Version 1.0.8 is the latest stable release. It requires esbuild as a peer dependency, builds output based on esbuild's metafile, and supports custom filenames, output paths, metadata injection, and custom processing via processOutput. Key differentiators: lightweight, no extra runtime dependencies, focused solely on manifest generation, and fully typed with TypeScript definitions.

npm install esbuild-plugin-assets-manifest
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-ASS
E
esbuild-plugin-assets-manifest
devopsjavascriptv1.0.8
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.

default
✓ import assetsManifest from 'esbuild-plugin-assets-manifest'
✗ const { assetsManifest } = require('esbuild-plugin-assets-manifest')
Default export is a function. Named export none, so named destructured require fails.
default
✓ const assetsManifest = require('esbuild-plugin-assets-manifest')
CommonJS require works fine.
default
✓ import assetsManifest from 'esbuild-plugin-assets-manifest'
Both ESM and CJS supported.

Builds an entry point and generates a manifest JSON file with custom metadata and indentation.

const esbuild = require('esbuild'); const assetsManifest = require('esbuild-plugin-assets-manifest'); await esbuild.build({ entryPoints: { app: './src/index.js' }, outdir: 'dist', bundle: true, metafile: true, plugins: [ assetsManifest({ filename: 'manifest.json', path: './dist', metadata: { version: '1.0.0', builtAt: new Date().toISOString() }, processOutput: (assets) => JSON.stringify(assets, null, 2), }) ] });
Debug
Known issues
gotchaEntry points must be an object (not array) for the manifest to include named entries.
fix
Use entryPoints: { app: './src/app.js' } instead of entryPoints: ['./src/app.js'].
affects: >=1.0.0
gotchametafile must be set to true in esbuild options for the plugin to work.
fix
Add metafile: true to your esbuild build options.
affects: >=1.0.0
gotchaThe plugin does not validate that the manifest path exists; ensure the output directory exists before build.
fix
Create the directory manually or use a plugin like esbuild-plugin-copy to ensure it exists.
affects: >=1.0.0
gotchaWhen using publicPath, ensure it ends with '/' to avoid missing slashes in asset URLs.
fix
Set publicPath: '/static/' (trailing slash) instead of '/static'.
affects: >=1.0.0
gotchaThe manifest JSON may not include assets from code splitting or dynamic imports; only entry point outputs.
fix
If code splitting is used, additional processing may be needed; no built-in support.
affects: >=1.0.0
Errors
Common errors & fixes
Error: The plugin 'assets-manifest' must be called before build starts
Attempting to call the plugin function as if it were a class (e.g., new assetsManifest())
fix
Call the function directly without 'new': assetsManifest({...})
TypeError: assetsManifest is not a function
Incorrect import syntax in ESM (e.g., using named import instead of default import)
fix
Use default import: import assetsManifest from 'esbuild-plugin-assets-manifest'
Error: Build failed with 1 error: error: Invalid 'entryPoints': expected object
Passed entryPoints as an array instead of an object
fix
Change entryPoints to an object: { app: './src/app.js' }
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency required; plugin hooks into esbuild's plugin system.
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-plugin-assets-manifest — npm install esbuild-plugin-assets-manifest · libregistry