npm i --save-dev hash-webpack-export-plugin
webpack.config.js
const HtmlWebpackPlugin = require('hash-webpack-export-plugin')
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new HashExportPlugin({
filename: 'your file name, default `version`',
outPath: 'your out path, default `__dirname`'
})
]
}
This will generate a file version.json
containing the following
version.json
{
"previous":"59362f9364ad0dcfce67",
"current":"59362f9364ad0dcfce67"
}
npm run example