mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 03:57:06 -04:00
Make our Webpack config compatible with Node 18+
Node 18 and newer switched to OpenSSL 3, which does not support the MD4
hash algorithm.
Unfortunately, Webpack 4 hardcodes the use of MD4 at various places.
This leaves us no other option than to monkey-patch node to transform
calls to the MD4 hash to use SHA256.
References:
https://github.com/webpack/webpack/issues/14532
69691525 (69691525)
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
b1928b77b4
commit
6a916d060a
2 changed files with 8 additions and 1 deletions
|
@ -107,7 +107,7 @@
|
||||||
"xss": "^1.0.3"
|
"xss": "^1.0.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x"
|
"node": ">=16"
|
||||||
},
|
},
|
||||||
"bugs": "https://github.com/hedgedoc/hedgedoc/issues",
|
"bugs": "https://github.com/hedgedoc/hedgedoc/issues",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -5,6 +5,13 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
||||||
|
|
||||||
|
// This monkey-patches node to use sha256 instead of md4 for crypto.createHash
|
||||||
|
// md4 is not available in node 18+ anymore, as that uses modern OpenSSL versions
|
||||||
|
// Inspired by https://stackoverflow.com/questions/69394632/webpack-build-failing-with-err-ossl-evp-unsupported/69691525#69691525
|
||||||
|
const crypto = require('crypto')
|
||||||
|
const cryptoOrigCreateHash = crypto.createHash
|
||||||
|
crypto.createHash = algorithm => cryptoOrigCreateHash(algorithm === 'md4' ? 'sha256' : algorithm)
|
||||||
|
|
||||||
// Fix possible nofile-issues
|
// Fix possible nofile-issues
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const gracefulFs = require('graceful-fs')
|
const gracefulFs = require('graceful-fs')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue