I will do versioning via hashing. And this with Webpack.
Content of: webpack.config.js
...
output: {
path: path.resolve(__dirname, 'web/dist'),
filename: '[name].[contenthash].js',
},
...
webpack generate some files, i think its okay, its a hash...
app.d471b97fd69a6837f5bf.js
In my index.html file must replace the filenames to, i do it with "replacer-contenthash-webpack-plugin" Plugin for Webpack. It used the loaderUtils.getHashDigest(buffer) do generate a hash. But its not the same its generate this 174d0b0d04495cf7a970 hash.
Content of: index.html
<script src="dist/app.174d0b0d04495cf7a970.js"></script>
how can i fix it? I dont no how webpack generate the hash with [hashcode]. Its not specified.
i have tried, to specified contenthash digest, length and function:
output: {
path: path.resolve(__dirname, 'web/dist'),
filename: '[name].[contenthash].js',
hashFunction: "md5",
hashDigest: "hex",
hashDigestLength: 32
},
and specified the used Webpack extension getHashDigest() so:
getHashDigest(buffer, "md5", "hex", 32)
=>
app.54949ecc3046a8e7e56e8d9875970ca2.js
but index.html different :(
<script src="dist/app.174d0b0d04495cf7a970e84cc9a96cdb.js"></script>