js-d3-flame-graph/SOURCES/001-remove-unused-frontend-crypto-and-patch-md4.patch
2021-12-09 12:57:14 +00:00

63 lines
1.9 KiB
Diff

diff --git a/package.json b/package.json
index 9469638..d81424f 100644
--- a/package.json
+++ b/package.json
@@ -61,5 +61,9 @@
"d3-scale": "^3.2.1",
"d3-selection": "^1.4.1",
"d3-transition": "^1.3.2"
+ },
+ "resolutions": {
+ "crypto-browserify": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz",
+ "http-signature": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz"
}
}
diff --git a/webpack.config.js b/webpack.config.js
index 00e171a..8997a9f 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -8,6 +8,13 @@ const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const packageFile = require('./package.json')
+// monkey patch crypto module to not use deprecated md4 hash algorithm,
+// which is removed in OpenSSL 3.0
+// https://github.com/webpack/webpack/issues/13572#issuecomment-923736472
+const crypto = require("crypto");
+const crypto_orig_createHash = crypto.createHash;
+crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
+
module.exports = [{
context: path.join(__dirname, 'src'),
entry: {
@@ -21,6 +28,9 @@ module.exports = [{
libraryExport: 'default',
libraryTarget: 'umd'
},
+ node: {
+ crypto: false
+ },
plugins: [
new CopyWebpackPlugin([{
from: 'flamegraph.css',
@@ -58,6 +68,9 @@ module.exports = [{
library: ['flamegraph', '[name]'],
libraryTarget: 'umd'
},
+ node: {
+ crypto: false
+ },
module: {
rules: [{
test: /\.js$/,
@@ -79,6 +92,9 @@ module.exports = [{
path: path.resolve(__dirname, 'dist', 'templates'),
filename: 'bundle.js'
},
+ node: {
+ crypto: false
+ },
plugins: [
new CleanWebpackPlugin({
protectWebpackAssets: false,