{"id":13671214,"url":"https://github.com/shellscape/webpack-manifest-plugin","last_synced_at":"2025-05-10T08:08:35.962Z","repository":{"id":43003110,"uuid":"32652828","full_name":"shellscape/webpack-manifest-plugin","owner":"shellscape","description":"webpack plugin for generating asset manifests","archived":false,"fork":false,"pushed_at":"2025-03-11T23:18:05.000Z","size":699,"stargazers_count":1439,"open_issues_count":1,"forks_count":183,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-07T22:59:43.212Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shellscape.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"patreon":"shellscape","custom":"https://paypal.me/shellscape","liberapay":"shellscape"}},"created_at":"2015-03-21T22:36:51.000Z","updated_at":"2025-04-28T00:12:36.000Z","dependencies_parsed_at":"2025-04-28T15:42:53.207Z","dependency_job_id":"9d32e902-c04e-4990-83ff-332a8fdaed87","html_url":"https://github.com/shellscape/webpack-manifest-plugin","commit_stats":{"total_commits":193,"total_committers":55,"mean_commits":"3.5090909090909093","dds":0.6735751295336787,"last_synced_commit":"64faade1402026eb22cfe8c712f44f67adb41610"},"previous_names":["danethurber/webpack-manifest-plugin"],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-manifest-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-manifest-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-manifest-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fwebpack-manifest-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellscape","download_url":"https://codeload.github.com/shellscape/webpack-manifest-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252968052,"owners_count":21833249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:03.223Z","updated_at":"2025-05-07T22:59:51.664Z","avatar_url":"https://github.com/shellscape.png","language":"JavaScript","readme":"[tests]: https://img.shields.io/circleci/project/github/shellscape/webpack-manifest-plugin.svg\n[tests-url]: https://circleci.com/gh/shellscape/webpack-manifest-plugin\n[cover]: https://codecov.io/gh/shellscape/webpack-manifest-plugin/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/shellscape/webpack-manifest-plugin\n[size]: https://packagephobia.now.sh/badge?p=webpack-manifest-plugin\n[size-url]: https://packagephobia.now.sh/result?p=webpack-manifest-plugin\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cimg width=\"256\" src=\"https://raw.githubusercontent.com/shellscape/webpack-manifest-plugin/master/assets/manifest.svg?sanitize=true\" alt=\"webpack-manfiest-plugin\"\u003e\u003cbr/\u003e\u003cbr/\u003e\n\u003c/div\u003e\n\n[![tests][tests]][tests-url]\n[![cover][cover]][cover-url]\n[![size][size]][size-url]\n[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)\n\n# webpack-manifest-plugin\n\nA Webpack plugin for generating an asset manifest.\n\n:heart: Please consider [Sponsoring my work](https://github.com/sponsors/shellscape)\n\n## Requirements\n\n`webpack-manifest-plugin` is an [evergreen 🌲](./.github/FAQ.md#what-does-evergreen-mean) module.\n\nThis module requires an [Active LTS](https://github.com/nodejs/Release) Node version (v12.0.0+) and Webpack v5.0.0.\n\n## Contributing\n\nThis repository leverages [pnpm](https://pnpm.js.org/) for dependency management.\n\nTo begin, please install `pnpm`:\n\n```console\n$ npm install pnpm -g\n```\n\n## Install\n\nUsing npm:\n\n```console\nnpm install webpack-nano webpack-manifest-plugin --save-dev\n```\n\n_Note: We recommend using [webpack-nano](https://github.com/shellscape/webpack-nano), a very tiny, very clean webpack CLI._\n\n## Usage\n\nCreate a `webpack.config.js` file:\n\n```js\nconst { WebpackManifestPlugin } = require('webpack-manifest-plugin');\nconst options = { ... };\n\nmodule.exports = {\n\t// an example entry definition\n\tentry: [ 'app.js'\t],\n  ...\n  plugins: [\n    new WebpackManifestPlugin(options)\n  ]\n};\n```\n\nAnd run `webpack`:\n\n```console\n$ npx wp\n```\n\nWith the default options, the example above will create a `manifest.json` file in the output directory for the build. The manifest file will contain a map of source filenames to the corresponding build output file. e.g.\n\n```json\n{\n  \"dist/batman.js\": \"dist/batman.1234567890.js\",\n  \"dist/joker.js\": \"dist/joker.0987654321.js\"\n}\n```\n\n### Options\n\n### `assetHookStage`\n\nType: `Number`\u003cbr\u003e\nDefault: `Infinity`\n\nIf you need to consume the output of this plugin in another plugin, it can be useful to adjust the stage at which the manifest is generated. Pass a new stage to `assetHookStage` to change when the manifest is generated. See the [docs on `processAssets`](https://webpack.js.org/api/compilation-hooks/#list-of-asset-processing-stages) for more detail.\n\nNote: any files added to the compilation after the stage specified will not be included in the manifest.\n\n### `basePath`\n\nType: `String`\u003cbr\u003e\nDefault: `''`\n\nSpecifies a path prefix for all keys in the manifest. Useful for including your output path in the manifest.\n\n### `fileName`\n\nType: `String`\u003cbr\u003e\nDefault: `manifest.json`\n\nSpecifies the file name to use for the resulting manifest. By default the plugin will emit `manifest.json` to your output directory. Passing an absolute path to the `fileName` option will override both the file name and path.\n\n### `filter`\n\nType: `Function`\u003cbr\u003e\nDefault: `undefined`\n\nAllows filtering the files which make up the manifest. The passed function should match the signature of `(file: FileDescriptor) =\u003e Boolean`. Return `true` to keep the file, `false` to remove the file.\n\n### `generate`\n\nType: `Function`\u003cbr\u003e\nDefault: `undefined`\n\nA custom `Function` to create the manifest. The passed function should match the signature of `(seed: Object, files: FileDescriptor[], entries: string[]) =\u003e Object` and can return anything as long as it's serialisable by `JSON.stringify`.\n\n### `map`\n\nType: `Function`\u003cbr\u003e\nDefault: `undefined`\n\nAllows modifying the files which make up the manifest. The passed function should match the signature of `(file: FileDescriptor) =\u003e FileDescriptor` where an object matching `FileDescriptor` is returned.\n\n### `publicPath`\n\nType: `String`\u003cbr\u003e\nDefault: `\u003cwebpack-config\u003e.output.publicPath`\n\nA path prefix that will be added to values of the manifest.\n\n### `removeKeyHash`\n\nType: `RegExp | false`\u003cbr\u003e\nDefault: `/([a-f0-9]{32}\\.?)/gi`\n\nIf set to a valid `RegExp`, removes hashes from manifest keys. e.g.\n\n```json\n{\n  \"index.c5a9bff71fdfed9b6046.html\": \"index.c5a9bff71fdfed9b6046.html\"\n}\n```\n\n```json\n{\n  \"index.html\": \"index.c5a9bff71fdfed9b6046.html\"\n}\n```\n\nThe default value for this option is a regular expression targeting Webpack's [default md5 hash](https://webpack.js.org/configuration/output/#outputhashfunction). To target other hashing functions / algorithms, set this option to an appropriate `RegExp`. To disable replacing the hashes in key names, set this option to `false`.\n\n### `seed`\n\nType: `Object`\u003cbr\u003e\nDefault: `{}`\n\nA cache of key/value pairs used to seed the manifest. This may include a set of [custom key/value](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json) pairs to include in your manifest, or may be used to combine manifests across compilations in [multi-compiler mode](https://github.com/webpack/webpack/tree/master/examples/multi-compiler). To combine manifests, pass a shared seed object to each compiler's `WebpackManifestPlugin` instance.\n\n### `serialize`\n\nType: `Function(Object) =\u003e string`\u003cbr\u003e\nDefault: `undefined`\n\nA `Function` which can be leveraged to serialize the manifest in a different format than json. e.g. `yaml`.\n\n### `sort`\n\nType: `Function`\u003cbr\u003e\nDefault: `undefined`\n\nAllows sorting the files which make up the manifest. The passed function should match the signature of `(fileA: FileDescriptor, fileB: FileDescriptor) =\u003e Number`. Return `0` to indicate no change, `-1` to indicate the file should be moved to a lower index, and `1` to indicate the file shoud be moved to a higher index.\n\n### `useEntryKeys`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, the keys specified in the `entry` property will be used as keys in the manifest. No file extension will be added (unless specified as part of an `entry` property key).\n\n### `useLegacyEmit`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, the manifest will be written on the deprecated webpack `emit` hook to be compatible with not yet updated webpack plugins.\n\nA lot of webpack plugins are not yet updated to match the new webpack 5 API. This is a problem when other plugins use the deprecated `emit` hook. The manifest will be written before these other plugins and thus files are missing on the manifest.\n\n### `writeToFileEmit`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, will emit the manifest to the build directory _and_ in memory for compatibility with `webpack-dev-server`.\n\n## Manifest File Descriptor\n\nThis plugin utilizes the following object structure to work with files. Many options for this plugin utilize the structure below.\n\n```ts\n{\n  chunk?: Chunk;\n  isAsset: boolean;\n  isChunk: boolean;\n  isInitial: boolean;\n  isModuleAsset: boolean;\n  name: string | null;\n  path: string;\n}\n```\n\n### `chunk`\n\nType: [`Chunk`](https://github.com/webpack/webpack/blob/master/lib/Chunk.js)\n\nOnly available if `isChunk` is `true`\n\n### `isInitial`\n\nType: `Boolean`\n\nIs required to run you app. Cannot be `true` if `isChunk` is `false`.\n\n### `isModuleAsset`\n\nType: `Boolean`\n\nIs required by a module. Cannot be `true` if `isAsset` is `false`.\n\n## Compiler Hooks\n\nThis plugin supports the following hooks via the `getCompilerHooks` export; `afterEmit`, `beforeEmit`. These hooks can be useful, e.g. changing manifest contents before emitting to disk.\n\n### `getCompilerHooks`\n\nReturns: `{ afterEmit: SyncWaterfallHook, beforeEmit: SyncWaterfallHook }`\n\n#### Usage\n\n```js\nconst { getCompilerHooks } = require('webpack-manifest-plugin');\n\nclass BatmanPlugin {\n  apply(compiler) {\n    const { beforeEmit } = getCompilerHooks(compiler);\n\n    beforeEmit.tap('BatmanPlugin', (manifest) =\u003e {\n      return { ...manifest, name: 'hello' };\n    });\n  }\n}\n```\n\n## Notes\n\n- If using this plugin with `webpack-clean` and `webpack-dev-server`, please review [this issue](https://github.com/shellscape/webpack-manifest-plugin/issues/267).\n\n## Attiribution\n\nSpecial thanks to [Dane Thurber](https://github.com/danethurber), the original author of this plugin, without whom this plugin would not exist.\n\n## Meta\n\n[CONTRIBUTING](./.github/CONTRIBUTING.md)\n\n[LICENSE (MIT)](./LICENSE)\n","funding_links":["https://patreon.com/shellscape","https://paypal.me/shellscape","https://liberapay.com/shellscape","https://github.com/sponsors/shellscape"],"categories":["TypeScript","JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellscape%2Fwebpack-manifest-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellscape%2Fwebpack-manifest-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellscape%2Fwebpack-manifest-plugin/lists"}