Skip to content

Commit 2c7379e

Browse files
committed
do not import window from browser pkg (circular import)
1 parent 9f7e283 commit 2c7379e

File tree

7 files changed

+13
-6
lines changed

7 files changed

+13
-6
lines changed

packages/feedback/src/constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import { GLOBAL_OBJ } from "@sentry/utils";
2+
3+
// exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser`
4+
// prevents the browser package from being bundled in the CDN bundle, and avoids a
5+
// circular dependency between the browser and replay packages
6+
export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
7+
18
const LIGHT_BACKGROUND = '#ffffff';
29
const INHERIT = 'inherit';
310
const SUBMIT_COLOR = 'rgba(108, 95, 199, 1)';

packages/feedback/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
1+
import { WINDOW } from './constants';
22
import type { Integration } from '@sentry/types';
33
import { isBrowser, logger } from '@sentry/utils';
44

packages/feedback/src/widget/Icon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
1+
import { WINDOW } from '../constants';
22

33
import { setAttributesNS } from '../util/setAttributesNS';
44

packages/feedback/src/widget/Logo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
1+
import { WINDOW } from '../constants';
22

33
import type { FeedbackInternalOptions } from '../types';
44
import { setAttributesNS } from '../util/setAttributesNS';

packages/feedback/src/widget/SuccessIcon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
1+
import { WINDOW } from '../constants';
22

33
import { setAttributesNS } from '../util/setAttributesNS';
44

packages/feedback/src/widget/createShadowHost.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
1+
import { WINDOW } from '../constants';
22
import { logger } from '@sentry/utils';
33

44
import type { FeedbackInternalOptions } from '../types';

packages/feedback/src/widget/util/createElement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WINDOW } from '@sentry/browser';
1+
import { WINDOW } from '../../constants';
22

33
/**
44
* Helper function to create an element. Could be used as a JSX factory

0 commit comments

Comments
 (0)