Skip to content

Commit

Permalink
Use md5 has for caching on node v17 (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reptarsrage committed Oct 20, 2021
1 parent 7fdf6f4 commit 0093525
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cache.js
Expand Up @@ -63,7 +63,14 @@ const write = async function (filename, compress, result) {
* @return {String}
*/
const filename = function (source, identifier, options) {
const hash = crypto.createHash("md4");
// md4 hashing is not supported starting with node v17.0.0
const majorNodeVersion = parseInt(process.versions.node.split(".")[0], 10);
let hashType = "md4";
if (majorNodeVersion >= 17) {
hashType = "md5";
}

const hash = crypto.createHash(hashType);

const contents = JSON.stringify({ source, options, identifier });

Expand Down

0 comments on commit 0093525

Please sign in to comment.