Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid using eval in client #5045

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions client-src/modules/logger/SyncBailHookFake.js

This file was deleted.

11 changes: 11 additions & 0 deletions client-src/modules/logger/tapable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function SyncBailHook() {
return {
call() {},
};
}

/**
* Client stub for tapable SyncBailHook
*/
// eslint-disable-next-line import/prefer-default-export
export { SyncBailHook };
22 changes: 9 additions & 13 deletions client-src/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ const path = require("path");
const webpack = require("webpack");
const { merge } = require("webpack-merge");

// @ts-ignore
const library = webpack.webpack
? {
library: {
// type: "module",
type: "commonjs",
},
}
: { libraryTarget: "umd" };
const library = {
library: {
// type: "module",
type: "commonjs",
},
};

const baseForModules = {
devtool: false,
Expand All @@ -28,8 +25,7 @@ const baseForModules = {
optimization: {
minimize: false,
},
// @ts-ignore
target: webpack.webpack ? ["web", "es5"] : "web",
target: ["web", "es5"],
module: {
rules: [
{
Expand Down Expand Up @@ -73,8 +69,8 @@ module.exports = [
'(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })',
}),
new webpack.NormalModuleReplacementPlugin(
/^tapable\/lib\/SyncBailHook/,
path.join(__dirname, "modules/logger/SyncBailHookFake.js"),
/^tapable$/,
path.join(__dirname, "modules/logger/tapable.js"),
),
],
}),
Expand Down