Skip to content

Commit

Permalink
Merge pull request #2 from FirstWhack/FirstWhack-patch-1
Browse files Browse the repository at this point in the history
Support crypto quirks in Node for codesandbox
  • Loading branch information
FirstWhack authored Jun 3, 2024
2 parents 0891b57 + 354fee6 commit 3add07c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/app1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const path = require("path");

// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

module.exports = {
entry: "./index.js",
mode: "development",
Expand All @@ -12,7 +17,8 @@ module.exports = {
port: 1337
},
output: {
publicPath: "auto"
publicPath: "auto",
hashFunction: "sha256"
},
module: {
rules: [
Expand Down
8 changes: 7 additions & 1 deletion packages/app2/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");

const { ModuleFederationPlugin } = webpack.container;

// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

module.exports = {
entry: "./index.js",
mode: "development",
Expand All @@ -13,7 +18,8 @@ module.exports = {
port: 1338
},
output: {
publicPath: "auto"
publicPath: "auto",
hashFunction: "sha256"
},
module: {
rules: [
Expand Down
8 changes: 7 additions & 1 deletion packages/store/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");

const { ModuleFederationPlugin } = webpack.container;

// some webpack5/Node18 quirk, better than going with legacy openssl provider :shrug:
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

module.exports = {
// no entry
entry: {},
Expand All @@ -14,7 +19,8 @@ module.exports = {
port: 1339
},
output: {
publicPath: "auto"
publicPath: "auto",
hashFunction: "sha256"
},
module: {
rules: [
Expand Down

0 comments on commit 3add07c

Please sign in to comment.