From d56752e5a90d9d3b642ecc2f511ac35ee01d200e Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Sun, 19 Jan 2025 12:27:43 +0100 Subject: [PATCH] fix(utils/dynamicRequire): pass moduleName explicitly as string fixes the Webpack warning: "WARNING in ./src/public/app/services/utils.ts 249:15-34 Critical dependency: the request of a dependency is an expression" as we now explicitly pass the moduleName as string and not "expression" source: https://stackoverflow.com/questions/42908116/ --- src/public/app/services/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/public/app/services/utils.ts b/src/public/app/services/utils.ts index ff59d7170..7c7e47b31 100644 --- a/src/public/app/services/utils.ts +++ b/src/public/app/services/utils.ts @@ -308,7 +308,9 @@ function dynamicRequire(moduleName: string) { if (typeof __non_webpack_require__ !== "undefined") { return __non_webpack_require__(moduleName); } else { - return require(moduleName); + // explicitly pass as string and not as expression to suppress webpack warning + // 'Critical dependency: the request of a dependency is an expression' + return require(`${moduleName}`); } }