Skip to content

Commit

Permalink
fix module error in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
njmulsqb committed Jan 2, 2025
1 parent f85fca8 commit d7019fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/zapHomeFiles/hud/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,9 @@ const utils = (function () {
return dateObject.toISOString().slice(11, 23);
}

module.exports = {
if (typeof module == 'object') // This if check is for unit tests as they work in Node environment only because module.exports is not supported in browser
{
module.exports = {
parseRequestHeader,
parseResponseHeader,
isFromTrustedOrigin,
Expand Down Expand Up @@ -769,6 +771,7 @@ const utils = (function () {
log,
timestampToTimeString
};
}
return {
parseRequestHeader,
parseResponseHeader,
Expand Down
2 changes: 1 addition & 1 deletion src/webpack/loaders/zap-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = function zapLoader(source) {
source = source.replace('<<ZAP_HUD_URL>>', 'https://targetdomain.com');
source = source.replace('<<ZAP_HUD_API>>', 'https://zap/api');
source = source.replace('<<ZAP_HUD_WS>>', 'https://zap/websocket');
source = source.replace('<<ZAP_HUD_TOOLS>>', '\'http://zap/to/some/tool\'');
source = source.replace('<<ZAP_HUD_TOOLS>>', 'http://zap/to/some/tool');
source = source.replace('<<ZAP_SHARED_SECRET>>', 'sometestsecret');

return source;
Expand Down

0 comments on commit d7019fb

Please sign in to comment.