Skip to content

Commit 0093525

Browse files
authored
Use md5 has for caching on node v17 (#918)
1 parent 7fdf6f4 commit 0093525

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/cache.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ const write = async function (filename, compress, result) {
6363
* @return {String}
6464
*/
6565
const filename = function (source, identifier, options) {
66-
const hash = crypto.createHash("md4");
66+
// md4 hashing is not supported starting with node v17.0.0
67+
const majorNodeVersion = parseInt(process.versions.node.split(".")[0], 10);
68+
let hashType = "md4";
69+
if (majorNodeVersion >= 17) {
70+
hashType = "md5";
71+
}
72+
73+
const hash = crypto.createHash(hashType);
6774

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

0 commit comments

Comments
 (0)