esbuild-plugin-manifest
raw JSON → 1.0.5 verified Mon Apr 27 auth: no javascript
ESBuild plugin that generates a manifest.json file mapping original asset names (e.g., index.js) to their hashed output filenames (e.g., index-4QTUNIID.js). Version 1.0.5, stable, supports custom hash formats, short names, extensionless keys, filtering, appending, and custom manifest generators. Designed for cache busting with ESBuild's built-in hashing. Ships TypeScript definitions. Peer dependency on esbuild ~0.
Common errors
error TypeError: manifestPlugin is not a function ↓
cause Using named import instead of default import.
fix
Use 'import manifestPlugin from 'esbuild-plugin-manifest'' (default import).
error Error: Cannot find module 'esbuild-plugin-manifest' ↓
cause Package not installed or missing peer dependency esbuild.
fix
Install both: npm install --save-dev esbuild esbuild-plugin-manifest
error Type 'typeof import(...)' has no call signatures ↓
cause Using default import in TypeScript without esModuleInterop.
fix
Set 'esModuleInterop': true in tsconfig.json.
Warnings
gotcha Manifest keys include output directory path by default; use shortNames: true for basename-only. ↓
fix Set shortNames: true in plugin options.
gotcha If esbuild output hashes are disabled, the manifest will still map files but without unique hashes. ↓
fix Enable hashing in esbuild (e.g., entryNames: '[dir]/[name]-[hash]') or rely on plugin's default.
gotcha The manifest file overwrites by default; use append: true to merge with existing manifest. ↓
fix Set append: true in options.
deprecated No deprecation warnings in current version. ↓
fix N/A
Install
npm install esbuild-plugin-manifest yarn add esbuild-plugin-manifest pnpm add esbuild-plugin-manifest Imports
- default wrong
const manifestPlugin = require('esbuild-plugin-manifest')correctimport manifestPlugin from 'esbuild-plugin-manifest' - manifestPlugin wrong
import { manifestPlugin } from 'esbuild-plugin-manifest'correctimport manifestPlugin from 'esbuild-plugin-manifest' - type ManifestOptions wrong
import { ManifestOptions } from 'esbuild-plugin-manifest'correctimport type { ManifestOptions } from 'esbuild-plugin-manifest'
Quickstart
import esbuild from 'esbuild';
import manifestPlugin from 'esbuild-plugin-manifest';
await esbuild.build({
entryPoints: ['src/index.ts'],
bundle: true,
outdir: 'dist',
plugins: [manifestPlugin({
shortNames: true,
useEntrypointKeys: true,
})],
});