Skip to content

Commit

Permalink
Skip require http/https during webpack build
Browse files Browse the repository at this point in the history
  • Loading branch information
akiradev committed Jan 31, 2025
1 parent 02a7762 commit 3894786
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const log = debug('adzerk-decision-sdk:client');
const isNode = typeof process !== 'undefined' && process.title !== 'browser';
const isReactNative =
typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
/** @ts-ignore */
const isWebpack = typeof __webpack_require__ === 'function'
const deprecatedPlacementFields: Array<Array<string>> = [
['ecpmPartition', 'ecpmPartitions'],
];
Expand Down Expand Up @@ -398,7 +400,7 @@ export class Client {

this._path = opts.path;

if (isNode && !isReactNative) {
if (isNode && !isReactNative && !isWebpack) {
let { Agent } = require(protocol);
this._agent =
opts.agent ||
Expand Down

0 comments on commit 3894786

Please # to comment.