Webpack plugin for generating an asset manifest.
NOTE: The following is related to the next major version of
webpack-manifest-plugin, please check https://github.com/danethurber/webpack-manifest-plugin/blob/1.x/README.md forv1documentation
npm install --save-dev webpack-manifest-pluginIn your webpack.config.js
var ManifestPlugin = require('webpack-manifest-plugin');
module.exports = {
// ...
plugins: [
new ManifestPlugin()
]
};This will generate a manifest.json file in your root output directory with a mapping of all source file names to their corresponding output file, for example:
{
"mods/alpha.js": "mods/alpha.1234567890.js",
"mods/omega.js": "mods/omega.0987654321.js"
}// webpack.config.js
module.exports = {
output: {
publicPath
},
plugins: [
new ManifestPlugin(options)
]
}Type: String
A path prefix that will be added to values of the manifest.
Type: String
Default: manifest.json
The manifest filename in your output directory.
Type: String
A path prefix for all keys. Useful for including your output path in the manifest.
Type: Boolean
Default: false
If set to true will emit to build folder and memory in combination with webpack-dev-server
Type: Object
Default: {}
A cache of key/value pairs to used to seed the manifest. This may include a set of custom key/value pairs to include in your manifest, or may be used to combine manifests across compilations in multi-compiler mode. To combine manifests, pass a shared seed object to each compiler's ManifestPlugin instance.
Type: function
Filter out files. more details
Type: function
Modify files details before the manifest is created. more details
Type: function
Sort files before they are passed to generate. more details
Type: function
Default: (seed, files) => files.reduce((manifest, {name, path}) => ({...manifest, [name]: path}), seed)
All entries in files correspond to the object structure described in the Hooks Options section.
Create the manifest. It can return anything as long as it's serialisable by JSON.stringify. more details
Type: function
Default: (manifest) => JSON.stringify(manifest, null, 2)
Output manifest file in different format then json (i.e. yaml).
filter, map, sort takes as an input an Object with the following properties:
Type: String
Type: Chunk
Type: String, null
Type: Boolean
Type: Boolean
Is required to run you app. Cannot be true if isChunk is false.
Type: Boolean
Type: Boolean
Is required by a module. Cannot be true if isAsset is false.
MIT © Dane Thurber