{"id":20791,"library":"webpack-manifest-plugin","title":"Webpack Manifest Plugin","description":"A Webpack plugin that generates a JSON manifest file mapping source filenames to their corresponding built output filenames, useful for server-side rendering or cache busting. Current stable version is 6.0.1, which is ESM-only and requires Node.js 20.19.0+ and Webpack 5.75.0+. Maintained by shellscape. Releases follow semantic versioning with major breaking changes in v6 (ESM switch, Node 20+), v5 (drop webpack v4), v4 (TypeScript types added). Primarily differentiates from similar plugins by its simplicity and configurability (filter, map, generate options). Peer dependency on webpack ^5.75.0.","status":"active","version":"6.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/shellscape/webpack-manifest-plugin","tags":["javascript","typescript"],"install":[{"cmd":"npm install webpack-manifest-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-manifest-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-manifest-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"required peer dependency for plugin functionality","package":"webpack","optional":false}],"imports":[{"note":"ESM-only since v6.0.0; require() will throw ERR_REQUIRE_ESM.","wrong":"const WebpackManifestPlugin = require('webpack-manifest-plugin')","symbol":"WebpackManifestPlugin","correct":"import { WebpackManifestPlugin } from 'webpack-manifest-plugin'"},{"note":"FileDescriptor is a TypeScript type (exported as type), not a runtime value.","wrong":"import { FileDescriptor } from 'webpack-manifest-plugin'","symbol":"type FileDescriptor","correct":"import type { FileDescriptor } from 'webpack-manifest-plugin'"},{"note":"This package exports only a named member, not a default export.","wrong":"import WebpackManifestPlugin from 'webpack-manifest-plugin'","symbol":"default import","correct":"import { WebpackManifestPlugin } from 'webpack-manifest-plugin'"}],"quickstart":{"code":"// webpack.config.mjs\nimport { WebpackManifestPlugin } from 'webpack-manifest-plugin';\n\nexport default {\n  entry: './src/index.js',\n  output: {\n    filename: '[name].[contenthash:8].js',\n    path: new URL('./dist', import.meta.url).pathname,\n  },\n  plugins: [\n    new WebpackManifestPlugin({\n      fileName: 'asset-manifest.json',\n      basePath: '/app/',\n      publicPath: '/app/',\n      filter: (file) => file.isInitial,\n      map: (file) => ({ ...file, path: file.path.replace(/^\\.\\//, '') }),\n    }),\n  ],\n  mode: 'production',\n};","lang":"typescript","description":"Minimal webpack config ESM showing plugin setup with common options: fileName, basePath, publicPath, filter, and map."},"warnings":[{"fix":"Convert project to ESM or continue using v5.x if CJS is required.","message":"v6.0.0 dropped CommonJS support; only ESM is supported.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Upgrade Node.js to 20.19.0 or later, or pin to v5.x.","message":"v6.0.0 requires Node.js >=20.19.0.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Upgrade to webpack v5 or use v4.x of this plugin.","message":"v5.0.0 dropped support for webpack v4.","severity":"breaking","affected_versions":">=5.0.0 <6.0.0"},{"fix":"Remove 'useLegacyEmit' from options; use 'assetHookStage' instead.","message":"Option 'useLegacyEmit' was removed in v5 without replacement.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Always explicitly return true/false from the filter function.","message":"If using the 'filter' option, ensure it returns Boolean. Incorrect return values (e.g. undefined) cause unexpected behavior.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use 'generate' only when you need full control; otherwise use 'filter'/'map'.","message":"The 'generate' option replaces the entire manifest object. If 'generate' is provided, 'filter', 'map', and other options are ignored for that function's logic.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change config to ESM: rename file to .mjs and use import, or use dynamic import().","cause":"Using require() with an ESM-only package (v6+).","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/webpack-manifest-plugin/dist/index.js from /path/to/project/webpack.config.js not supported."},{"fix":"Use file.isInitial directly: filter: (file) => file.isInitial","cause":"Using the 'filter' option and referencing 'isInitial' incorrectly (it's a boolean property, not a method).","error":"TypeError: file.isInitial is not a function"},{"fix":"Upgrade to webpack v5 or use webpack-manifest-plugin v4.x.","cause":"Using webpack-manifest-plugin v5+ with webpack v4.","error":"Module parse failed: Unexpected token with webpack 4"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}