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/
This commit is contained in:
Panagiotis Papadopoulos 2025-01-19 12:27:43 +01:00
parent 9025516806
commit d56752e5a9

View File

@ -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}`);
}
}