Skip to content

Commit

Permalink
Disable the network plugin if the 'window' object does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
agrzegorzewski committed Jul 5, 2024
1 parent bf17211 commit 260d000
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-network-breadcrumbs/network-breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const includes = require('@bugsnag/core/lib/es-utils/includes')
/*
* Leaves breadcrumbs when network requests occur
*/
module.exports = (_ignoredUrls = [], win = window) => {
module.exports = (_ignoredUrls = [], win = typeof window !== 'undefined' ? window : null) => {
let restoreFunctions = []
const plugin = {
load: client => {
if (!client._isBreadcrumbTypeEnabled('request')) return
if (!client._isBreadcrumbTypeEnabled('request') || window === null) return

const ignoredUrls = [
client._config.endpoints.notify,
Expand Down

0 comments on commit 260d000

Please sign in to comment.