Skip to content

Commit 3add07c

Browse files
authored
Merge pull request #2 from FirstWhack/FirstWhack-patch-1
Support crypto quirks in Node for codesandbox
2 parents 0891b57 + 354fee6 commit 3add07c

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

packages/app1/webpack.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ const ModuleFederationPlugin = require("webpack").container
33
.ModuleFederationPlugin;
44
const path = require("path");
55

6+
// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
7+
const crypto = require("crypto");
8+
const crypto_orig_createHash = crypto.createHash;
9+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
10+
611
module.exports = {
712
entry: "./index.js",
813
mode: "development",
@@ -12,7 +17,8 @@ module.exports = {
1217
port: 1337
1318
},
1419
output: {
15-
publicPath: "auto"
20+
publicPath: "auto",
21+
hashFunction: "sha256"
1622
},
1723
module: {
1824
rules: [

packages/app2/webpack.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
44

55
const { ModuleFederationPlugin } = webpack.container;
66

7+
// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
11+
712
module.exports = {
813
entry: "./index.js",
914
mode: "development",
@@ -13,7 +18,8 @@ module.exports = {
1318
port: 1338
1419
},
1520
output: {
16-
publicPath: "auto"
21+
publicPath: "auto",
22+
hashFunction: "sha256"
1723
},
1824
module: {
1925
rules: [

packages/store/webpack.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
44

55
const { ModuleFederationPlugin } = webpack.container;
66

7+
// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
11+
712
module.exports = {
813
// no entry
914
entry: {},
@@ -14,7 +19,8 @@ module.exports = {
1419
port: 1339
1520
},
1621
output: {
17-
publicPath: "auto"
22+
publicPath: "auto",
23+
hashFunction: "sha256"
1824
},
1925
module: {
2026
rules: [

0 commit comments

Comments
 (0)