Skip to content

Commit b8c46ea

Browse files
非凡少年Luca Forstner
非凡少年
and
Luca Forstner
authored
fix(nextjs): Use globalThis instead of global in edge runtime (#9612)
Co-authored-by: Luca Forstner <[email protected]>
1 parent 2f17bb1 commit b8c46ea

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/nextjs/src/config/loaders/valueInjectionLoader.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export default function valueInjectionLoader(this: LoaderThis<LoaderOptions>, us
1919
this.cacheable(false);
2020

2121
// Define some global proxy that works on server and on the browser.
22-
let injectedCode = 'var _sentryCollisionFreeGlobalObject = typeof window === "undefined" ? global : window;\n';
22+
let injectedCode =
23+
'var _sentryCollisionFreeGlobalObject = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};\n';
2324

2425
Object.entries(values).forEach(([key, value]) => {
2526
injectedCode += `_sentryCollisionFreeGlobalObject["${key}"] = ${JSON.stringify(value)};\n`;

0 commit comments

Comments
 (0)