diff --git a/package.json b/package.json
index f03150486cdb..9611ed9efd2d 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"packages/hub",
"packages/integration-tests",
"packages/integrations",
+ "packages/integration-shims",
"packages/overhead-metrics",
"packages/nextjs",
"packages/node",
diff --git a/packages/browser/package.json b/packages/browser/package.json
index ceabd802c7f0..566dd02081c0 100644
--- a/packages/browser/package.json
+++ b/packages/browser/package.json
@@ -23,6 +23,7 @@
"tslib": "^1.9.3"
},
"devDependencies": {
+ "@sentry-internal/integration-shims": "7.42.0",
"@types/md5": "2.1.33",
"btoa": "^1.2.1",
"chai": "^4.1.2",
diff --git a/packages/integration-shims/.eslintrc.js b/packages/integration-shims/.eslintrc.js
new file mode 100644
index 000000000000..0c83f7d0ff9d
--- /dev/null
+++ b/packages/integration-shims/.eslintrc.js
@@ -0,0 +1,8 @@
+// Note: All paths are relative to the directory in which eslint is being run, rather than the directory where this file
+// lives
+
+// ESLint config docs: https://eslint.org/docs/user-guide/configuring/
+
+module.exports = {
+ extends: ['../../.eslintrc.js'],
+};
diff --git a/packages/integration-shims/LICENSE b/packages/integration-shims/LICENSE
new file mode 100644
index 000000000000..d11896ba1181
--- /dev/null
+++ b/packages/integration-shims/LICENSE
@@ -0,0 +1,14 @@
+Copyright (c) 2023 Sentry (https://sentry.io) and individual contributors. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/packages/integration-shims/README.md b/packages/integration-shims/README.md
new file mode 100644
index 000000000000..523e3e4fd85f
--- /dev/null
+++ b/packages/integration-shims/README.md
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+# Sentry Integration Shims
+
+This internal package exports shims for Integrations, which are used in order to guarantee a consistent CDN bundle output.
diff --git a/packages/integration-shims/package.json b/packages/integration-shims/package.json
new file mode 100644
index 000000000000..b023ebbce267
--- /dev/null
+++ b/packages/integration-shims/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "@sentry-internal/integration-shims",
+ "version": "7.42.0",
+ "description": "Shims for integrations in Sentry SDK.",
+ "main": "build/cjs/index.js",
+ "module": "build/esm/index.js",
+ "types": "build/types/index.d.ts",
+ "sideEffects": false,
+ "private": true,
+ "scripts": {
+ "build": "run-p build:transpile build:types",
+ "build:transpile": "rollup -c rollup.npm.config.js",
+ "build:types": "tsc -p tsconfig.types.json",
+ "build:dev": "yarn build",
+ "build:watch": "run-p build:transpile:watch build:types:watch",
+ "build:dev:watch": "run-p build:watch",
+ "build:transpile:watch": "yarn build:rollup --watch",
+ "build:types:watch": "yarn build:types --watch",
+ "clean": "rimraf build",
+ "fix": "run-s fix:eslint fix:prettier",
+ "fix:eslint": "eslint . --format stylish --fix",
+ "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
+ "lint": "run-s lint:prettier lint:eslint",
+ "lint:eslint": "eslint . --format stylish",
+ "lint:prettier": "prettier --check \"{src,test}/**/*.ts\""
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/getsentry/sentry-javascript.git"
+ },
+ "author": "Sentry",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/getsentry/sentry-javascript/issues"
+ },
+ "devDependencies": {},
+ "dependencies": {},
+ "engines": {
+ "node": ">=12"
+ },
+ "volta": {
+ "extends": "../../package.json"
+ }
+}
diff --git a/packages/integration-shims/rollup.npm.config.js b/packages/integration-shims/rollup.npm.config.js
new file mode 100644
index 000000000000..2928d05abeed
--- /dev/null
+++ b/packages/integration-shims/rollup.npm.config.js
@@ -0,0 +1,7 @@
+import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';
+
+export default makeNPMConfigVariants(
+ makeBaseNPMConfig({
+ entrypoints: ['src/index.ts'],
+ }),
+);
diff --git a/packages/browser/src/shims/Replay.ts b/packages/integration-shims/src/Replay.ts
similarity index 95%
rename from packages/browser/src/shims/Replay.ts
rename to packages/integration-shims/src/Replay.ts
index 3fd9567a7f1b..c89bbd415d5f 100644
--- a/packages/browser/src/shims/Replay.ts
+++ b/packages/integration-shims/src/Replay.ts
@@ -5,7 +5,7 @@ import type { Integration } from '@sentry/types';
* It is needed in order for the CDN bundles to continue working when users add/remove replay
* from it, without changing their config. This is necessary for the loader mechanism.
*/
-export class ReplayShim implements Integration {
+class ReplayShim implements Integration {
/**
* @inheritDoc
*/
diff --git a/packages/integration-shims/src/index.ts b/packages/integration-shims/src/index.ts
new file mode 100644
index 000000000000..a55c52bcb483
--- /dev/null
+++ b/packages/integration-shims/src/index.ts
@@ -0,0 +1 @@
+export * from './Replay';
diff --git a/packages/integration-shims/tsconfig.json b/packages/integration-shims/tsconfig.json
new file mode 100644
index 000000000000..dd48230408ab
--- /dev/null
+++ b/packages/integration-shims/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "module": "esnext",
+ "lib": ["ES6"],
+ "esModuleInterop": true,
+ "target": "es6",
+ "strictPropertyInitialization": false
+ },
+ "include": ["src/**/*.ts"]
+}
diff --git a/packages/integration-shims/tsconfig.types.json b/packages/integration-shims/tsconfig.types.json
new file mode 100644
index 000000000000..16be672259fb
--- /dev/null
+++ b/packages/integration-shims/tsconfig.types.json
@@ -0,0 +1,10 @@
+{
+ "extends": "./tsconfig.json",
+ "include": ["src/index.ts"],
+ "compilerOptions": {
+ "declaration": true,
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "outDir": "build/types"
+ }
+}
diff --git a/packages/tracing/package.json b/packages/tracing/package.json
index 7de19de9d4c9..6fb8ea501ef3 100644
--- a/packages/tracing/package.json
+++ b/packages/tracing/package.json
@@ -23,6 +23,7 @@
},
"devDependencies": {
"@sentry/browser": "7.42.0",
+ "@sentry-internal/integration-shims": "7.42.0",
"@types/express": "^4.17.14"
},
"scripts": {
diff --git a/rollup/bundleHelpers.js b/rollup/bundleHelpers.js
index 5ec0ae0bd018..e9220b05b720 100644
--- a/rollup/bundleHelpers.js
+++ b/rollup/bundleHelpers.js
@@ -44,6 +44,7 @@ export function makeBaseBundleConfig(options) {
const licensePlugin = makeLicensePlugin(licenseTitle);
const tsPlugin = makeTSPlugin(jsVersion.toLowerCase());
const excludeReplayPlugin = makeExcludeBlockPlugin('REPLAY');
+ const excludeReplayShimPlugin = makeExcludeBlockPlugin('REPLAY_SHIM');
const excludeOfflineTransport = makeExcludeBlockPlugin('OFFLINE');
const excludeBrowserProfiling = makeExcludeBlockPlugin('BROWSER_PROFILING');
const replayShimPlugin = makeShimReplayPlugin();
@@ -65,7 +66,11 @@ export function makeBaseBundleConfig(options) {
if (includeReplay === 'shim') {
standAloneBundleConfig.plugins.push(replayShimPlugin);
- } else if (!includeReplay) {
+ } else {
+ standAloneBundleConfig.plugins.push(excludeReplayShimPlugin);
+ }
+
+ if (!includeReplay) {
standAloneBundleConfig.plugins.push(excludeReplayPlugin);
}
diff --git a/rollup/plugins/bundlePlugins.js b/rollup/plugins/bundlePlugins.js
index 260dc29e9b24..f3bb003d5ffb 100644
--- a/rollup/plugins/bundlePlugins.js
+++ b/rollup/plugins/bundlePlugins.js
@@ -220,7 +220,7 @@ export function makeShimReplayPlugin() {
// This is designed to replace the re-export in browser/index.ts to export the shim
const plugin = modify({
find: '@sentry/replay',
- replace: './shims/Replay',
+ replace: '@sentry-internal/integration-shims',
});
// give it a nicer name for later, when we'll need to sort the plugins