Skip to content

Commit c6199f7

Browse files
committed
fix(opentelemetry-core): adding web worker and ssr support
1 parent 60c04b1 commit c6199f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/opentelemetry-core/src/platform/browser/environment.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import {
2525
* Gets the environment variables
2626
*/
2727
export function getEnv(): Required<ENVIRONMENT> {
28-
const _window = window as typeof window & RAW_ENVIRONMENT;
28+
const _window = (typeof window === 'undefined'
29+
? self
30+
: window) as typeof window & RAW_ENVIRONMENT;
2931
const globalEnv = parseEnvironment(_window);
3032
return Object.assign({}, DEFAULT_ENVIRONMENT, globalEnv);
3133
}

0 commit comments

Comments
 (0)