Skip to content

Commit 6e915c3

Browse files
authored
build(replay): Remove replay version string replacement (#6367)
Remove the magic string replacement of `__SENTRY_REPLAY_VERSION__` at build time in favour of `@sentry/core`'s `SENTRY_VERSION` constant.
1 parent 7533e77 commit 6e915c3

File tree

4 files changed

+2
-20
lines changed

4 files changed

+2
-20
lines changed

packages/replay/jest.setup.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import { Transport } from '@sentry/types';
55
import { Replay } from './src';
66
import { Session } from './src/session/Session';
77

8-
// @ts-ignore TS error, this is replaced in prod builds bc of rollup
9-
global.__SENTRY_REPLAY_VERSION__ = 'version:Test';
10-
118
type MockTransport = jest.MockedFunction<Transport['send']>;
129

1310
jest.mock('./src/util/isBrowser', () => {

packages/replay/rollup.npm.config.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import replace from '@rollup/plugin-replace';
2-
31
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index';
42

53
import pkg from './package.json';
@@ -9,15 +7,6 @@ export default makeNPMConfigVariants(
97
hasBundles: true,
108
packageSpecificConfig: {
119
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})],
12-
plugins: [
13-
// TODO: Remove this - replay version will be in sync w/ SDK version
14-
replace({
15-
preventAssignment: true,
16-
values: {
17-
__SENTRY_REPLAY_VERSION__: JSON.stringify(pkg.version),
18-
},
19-
}),
20-
],
2110
output: {
2211
// set exports to 'named' or 'auto' so that rollup doesn't warn about
2312
// the default export in `worker/worker.js`

packages/replay/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable max-lines */ // TODO: We might want to split this file up
22
import { WINDOW } from '@sentry/browser';
3-
import { addGlobalEventProcessor, getCurrentHub, Scope, setContext } from '@sentry/core';
3+
import { addGlobalEventProcessor, getCurrentHub, Scope, SDK_VERSION, setContext } from '@sentry/core';
44
import { Breadcrumb, Client, Event, Integration } from '@sentry/types';
55
import { addInstrumentationHandler, createEnvelope, logger } from '@sentry/utils';
66
import debounce from 'lodash.debounce';
@@ -1208,7 +1208,7 @@ export class Replay implements Integration {
12081208

12091209
const sdkInfo = {
12101210
name: 'sentry.javascript.integration.replay',
1211-
version: __SENTRY_REPLAY_VERSION__,
1211+
version: SDK_VERSION,
12121212
};
12131213

12141214
const replayEvent = await new Promise(resolve => {

packages/replay/src/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ export interface WorkerRequest {
3333
args: unknown[];
3434
}
3535

36-
declare global {
37-
const __SENTRY_REPLAY_VERSION__: string;
38-
}
39-
4036
// PerformancePaintTiming and PerformanceNavigationTiming are only available with TS 4.4 and newer
4137
// Therefore, we're exporting them here to make them available in older TS versions
4238
export type PerformancePaintTiming = PerformanceEntry;

0 commit comments

Comments
 (0)