1 Star 0 Fork 2

rockerzhu/js-d3-flame-graph

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
001-remove-unused-frontend-crypto-and-patch-md4.patch 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
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,
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rockerzhu/js-d3-flame-graph.git
git@gitee.com:rockerzhu/js-d3-flame-graph.git
rockerzhu
js-d3-flame-graph
js-d3-flame-graph
master

搜索帮助