Skip to content

Commit

Permalink
Merge pull request #96 from adzerk/akirasato/sc-68087/decision-js-sdk…
Browse files Browse the repository at this point in the history
…-using-nodejs-deps-client

Skip require http/https during webpack build
  • Loading branch information
akiradev authored Jan 31, 2025
2 parents 02a7762 + e05de5f commit 38f1623
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adzerk/decision-sdk",
"version": "1.0.0-beta.25",
"version": "1.0.0-beta.26",
"description": "SDK for interacting with Adzerk's Decision API",
"main": "lib/index.js",
"clientSideApp": "dist/adzerk-decision-sdk.js",
Expand Down
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 38f1623

Please # to comment.