Skip to content

Commit 8425d1e

Browse files
wongchtfjsj
authored andcommitted
fix webpack 4 in node v18
1 parent 451e29a commit 8425d1e

7 files changed

+37
-0
lines changed

tests/webpack.config.error.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ var webpack = require('webpack');
33
var BundleTracker = require('webpack-bundle-tracker');
44
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
55

6+
// https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913
7+
// webpack 4 requires monkey-patch in node v18
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
611

712
module.exports = {
813
context: __dirname,

tests/webpack.config.gzipTest.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ var BundleTracker = require('webpack-bundle-tracker');
44
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
55
var CompressionPlugin = require('compression-webpack-plugin');
66

7+
// https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913
8+
// webpack 4 requires monkey-patch in node v18
9+
const crypto = require("crypto");
10+
const crypto_orig_createHash = crypto.createHash;
11+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
712

813
module.exports = {
914
context: __dirname,

tests/webpack.config.integrity.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ var webpack = require('webpack');
33
var BundleTracker = require('webpack-bundle-tracker');
44
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
55

6+
// https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913
7+
// webpack 4 requires monkey-patch in node v18
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
611

712
module.exports = {
813
context: __dirname,

tests/webpack.config.simple.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ var webpack = require('webpack');
33
var BundleTracker = require('webpack-bundle-tracker');
44
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
55

6+
// https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913
7+
// webpack 4 requires monkey-patch in node v18
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
11+
612

713
module.exports = {
814
context: __dirname,

tests/webpack.config.skipCommon.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ var webpack = require('webpack');
33
var BundleTracker = require('webpack-bundle-tracker');
44
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
55

6+
// https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913
7+
// webpack 4 requires monkey-patch in node v18
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
611

712
module.exports = {
813
context: __dirname,

tests/webpack.config.sourcemaps.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ var webpack = require('webpack');
33
var BundleTracker = require('webpack-bundle-tracker');
44
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
55

6+
// https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913
7+
// webpack 4 requires monkey-patch in node v18
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
611

712
module.exports = {
813
context: __dirname,

tests/webpack.config.split.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ var webpack = require('webpack');
33
var BundleTracker = require('webpack-bundle-tracker');
44
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
55

6+
// https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913
7+
// webpack 4 requires monkey-patch in node v18
8+
const crypto = require("crypto");
9+
const crypto_orig_createHash = crypto.createHash;
10+
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
11+
612

713
module.exports = {
814
context: __dirname,

0 commit comments

Comments
 (0)