From 1247386253579aff97dfb69206c33a121dc13985 Mon Sep 17 00:00:00 2001 From: Wesley Luyten Date: Mon, 2 Oct 2023 15:24:01 -0500 Subject: [PATCH] tools: patch Webpack Node.js >= 17 hash issue Co-authored-by: Jesse Portnoy --- webpack/config.babel.js | 3 +++ webpack/dist.babel.js | 3 +++ webpack/production.babel.js | 3 +++ webpack/standalone.babel.js | 3 +++ 4 files changed, 12 insertions(+) diff --git a/webpack/config.babel.js b/webpack/config.babel.js index 40bf2af0..6d8586c5 100644 --- a/webpack/config.babel.js +++ b/webpack/config.babel.js @@ -99,3 +99,6 @@ export default { hints: false } } +const crypto = require('crypto') +const cryptoOrigCreateHash = crypto.createHash +crypto.createHash = algorithm => cryptoOrigCreateHash(algorithm === 'md4' ? 'sha256' : algorithm) diff --git a/webpack/dist.babel.js b/webpack/dist.babel.js index 36156972..7f0a428f 100644 --- a/webpack/dist.babel.js +++ b/webpack/dist.babel.js @@ -28,3 +28,6 @@ export default { }) ] } +const crypto = require('crypto') +const cryptoOrigCreateHash = crypto.createHash +crypto.createHash = algorithm => cryptoOrigCreateHash(algorithm === 'md4' ? 'sha256' : algorithm) diff --git a/webpack/production.babel.js b/webpack/production.babel.js index a145d14f..4253fdd2 100644 --- a/webpack/production.babel.js +++ b/webpack/production.babel.js @@ -22,3 +22,6 @@ export default { ] } } +const crypto = require('crypto') +const cryptoOrigCreateHash = crypto.createHash +crypto.createHash = algorithm => cryptoOrigCreateHash(algorithm === 'md4' ? 'sha256' : algorithm) diff --git a/webpack/standalone.babel.js b/webpack/standalone.babel.js index d561366d..50e7b022 100644 --- a/webpack/standalone.babel.js +++ b/webpack/standalone.babel.js @@ -25,3 +25,6 @@ export default { }) ] } +const crypto = require('crypto') +const cryptoOrigCreateHash = crypto.createHash +crypto.createHash = algorithm => cryptoOrigCreateHash(algorithm === 'md4' ? 'sha256' : algorithm)