Skip to content

Commit 7681477

Browse files
authoredFeb 13, 2024··
fix: avoid using eval in client (#5045)
1 parent 54abef7 commit 7681477

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed
 

‎client-src/modules/logger/SyncBailHookFake.js

-10
This file was deleted.

‎client-src/modules/logger/tapable.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function SyncBailHook() {
2+
return {
3+
call() {},
4+
};
5+
}
6+
7+
/**
8+
* Client stub for tapable SyncBailHook
9+
*/
10+
// eslint-disable-next-line import/prefer-default-export
11+
export { SyncBailHook };

‎client-src/webpack.config.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ const path = require("path");
44
const webpack = require("webpack");
55
const { merge } = require("webpack-merge");
66

7-
// @ts-ignore
8-
const library = webpack.webpack
9-
? {
10-
library: {
11-
// type: "module",
12-
type: "commonjs",
13-
},
14-
}
15-
: { libraryTarget: "umd" };
7+
const library = {
8+
library: {
9+
// type: "module",
10+
type: "commonjs",
11+
},
12+
};
1613

1714
const baseForModules = {
1815
devtool: false,
@@ -28,8 +25,7 @@ const baseForModules = {
2825
optimization: {
2926
minimize: false,
3027
},
31-
// @ts-ignore
32-
target: webpack.webpack ? ["web", "es5"] : "web",
28+
target: ["web", "es5"],
3329
module: {
3430
rules: [
3531
{
@@ -73,8 +69,8 @@ module.exports = [
7369
'(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })',
7470
}),
7571
new webpack.NormalModuleReplacementPlugin(
76-
/^tapable\/lib\/SyncBailHook/,
77-
path.join(__dirname, "modules/logger/SyncBailHookFake.js"),
72+
/^tapable$/,
73+
path.join(__dirname, "modules/logger/tapable.js"),
7874
),
7975
],
8076
}),

0 commit comments

Comments
 (0)
Please sign in to comment.