Skip to content

Commit 92ffd33

Browse files
committed
remove unused import
1 parent d565739 commit 92ffd33

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

packages/aws-serverless/src/init.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { Integration, Options } from '@sentry/core';
2-
import { applySdkMetadata, debug, getSDKSource } from '@sentry/core';
2+
import { applySdkMetadata, debug, envToBool,getSDKSource } from '@sentry/core';
33
import type { NodeClient, NodeOptions } from '@sentry/node';
44
import { getDefaultIntegrationsWithoutPerformance, initWithoutDefaultIntegrations } from '@sentry/node';
5-
import { envToBool } from '@sentry/core';
65
import { DEBUG_BUILD } from './debug-build';
76
import { awsIntegration } from './integration/aws';
87
import { awsLambdaIntegration } from './integration/awslambda';

packages/browser/src/utils/env.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ export function getEnvValue(key: string): string | undefined {
1919
}
2020

2121
// Try import.meta.env (available in Vite, Rollup, and other modern bundlers)
22+
// Use indirect evaluation to avoid syntax errors in unsupported environments
2223
try {
23-
// @ts-expect-error import.meta.env is not always available in all environments
24-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
25-
if (typeof import.meta !== 'undefined' && import.meta.env) {
26-
// @ts-expect-error import.meta.env is not always available in all environments
24+
const importMetaEnv = new Function('try { return import.meta.env } catch(e) { return undefined }')();
25+
if (importMetaEnv && typeof importMetaEnv === 'object') {
2726
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
28-
const value = import.meta.env[key];
27+
const value = importMetaEnv[key];
2928
if (value !== undefined) {
3029
return String(value);
3130
}

packages/browser/test/utils/env.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @vitest-environment jsdom
33
*/
44

5-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
66
import { getEnvValue } from '../../src/utils/env';
77

88
describe('getEnvValue', () => {

0 commit comments

Comments
 (0)