Webpack plugin for generating an asset manifest.
In 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"
}
A manifest is configurable using constructor options:
new ManifestPlugin({
fileName: 'my-manifest.json',
basePath: '/app/'
})
Options:
fileName
: The manifest filename in your output directory (manifest.json
by default).basePath
: A path prefix for all file references. Useful for including your output path in the manifest.stripSrc
: removes unwanted strings from source filenamescache
: In multi-compiler mode webpack will overwrite the manifest on each compilation. Passing a shared{}
as thecache
option into each compilation's ManifestPlugin will combine the manifest between compilations.