Webpack plugin to perform file versioning using a manifest.json
npm install versioning-webpack-pluginmanifest.json file for storing the filename aliases.This plugin cleans after itself by removing old manifest files when cleanup: true in the options.
npm i versioning-webpack-plugin --save-devjavascript
const VersioningPlugin = require('versioning-webpack-plugin')
const WebpackMd5Hash = require('webpack-md5-hash')module.exports = {
output: {
filename: "[name]-[chunkhash].js"
},
/// ... rest of config
plugins: [
// these are the default options
new VersioningPlugin({
cleanup: true, // should it remove old files?
basePath: './', // manifest.json base path
manifestFilename: 'manifest.json' // name of the manifest file
}),
new WebpackMd5Hash()
]
}
``