Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Process and resolve pull request comments#18235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@BYK
Copy link
Member

@BYKBYK commentedNov 17, 2025

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

This PR addresses critical feedback regarding environment variable detection, particularly for Vite-based frameworks.

Key Changes:

  • packages/browser/src/utils/env.ts: ThegetEnvValue function now checks bothprocess.env (for Webpack, Next.js, CRA) andimport.meta.env (for Vite, Astro, SvelteKit). This ensures that environment variables (like those for Spotlight) are correctly detected across a wider range of bundlers and frameworks, fixing a significant compatibility issue.
  • packages/browser/test/utils/env.test.ts: Updated unit tests to focus onprocess.env scenarios. Added a note explaining thatimport.meta.env cannot be unit tested due to its read-only, compile-time nature and is covered by e2e tests.
  • packages/browser/src/utils/spotlightConfig.ts: Added a comment to clarify the explicitreturn undefined for readability, noting its optimization in production builds.

Open in Cursor Open in Web

Co-authored-by: burak.kaya <burak.kaya@sentry.io>
@BYKBYK marked this pull request as ready for reviewNovember 17, 2025 18:46
@BYKBYK merged commit6ea8d90 intofeat/spotlight-environment-variable-supportNov 17, 2025
46 checks passed
@BYKBYK deleted the cursor/process-and-resolve-pull-request-comments-1f87 branchNovember 17, 2025 18:46
@github-actions
Copy link
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser24.63 kBaddedadded
@sentry/browser - with treeshaking flags23.13 kBaddedadded
@sentry/browser (incl. Tracing)41.28 kBaddedadded
@sentry/browser (incl. Tracing, Profiling)45.57 kBaddedadded
@sentry/browser (incl. Tracing, Replay)79.73 kBaddedadded
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags69.44 kBaddedadded
@sentry/browser (incl. Tracing, Replay with Canvas)84.43 kBaddedadded
@sentry/browser (incl. Tracing, Replay, Feedback)96.65 kBaddedadded
@sentry/browser (incl. Feedback)41.28 kBaddedadded
@sentry/browser (incl. sendFeedback)29.29 kBaddedadded
@sentry/browser (incl. FeedbackAsync)34.21 kBaddedadded
@sentry/react26.32 kBaddedadded
@sentry/react (incl. Tracing)43.22 kBaddedadded
@sentry/vue29.11 kBaddedadded
@sentry/vue (incl. Tracing)43.08 kBaddedadded
@sentry/svelte24.65 kBaddedadded
CDN Bundle27.01 kBaddedadded
CDN Bundle (incl. Tracing)41.9 kBaddedadded
CDN Bundle (incl. Tracing, Replay)78.45 kBaddedadded
CDN Bundle (incl. Tracing, Replay, Feedback)83.91 kBaddedadded
CDN Bundle - uncompressed79.06 kBaddedadded
CDN Bundle (incl. Tracing) - uncompressed124.21 kBaddedadded
CDN Bundle (incl. Tracing, Replay) - uncompressed240.24 kBaddedadded
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed253 kBaddedadded
@sentry/nextjs (client)45.37 kBaddedadded
@sentry/sveltekit (client)41.67 kBaddedadded
@sentry/node-core50.92 kBaddedadded
@sentry/node158.13 kBaddedadded
@sentry/node - without tracing92.78 kBaddedadded
@sentry/aws-serverless106.55 kBaddedadded

if(typeofimport.meta!=='undefined'&&import.meta.env){
//@ts-expect-error import.meta.env is typed differently in different environments
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
constvalue=import.meta.env[key];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bug: Vite: Dynamic Env Var Access Not Supported

The dynamic accessimport.meta.env[key] won't work in Vite-based frameworks. Vite performs static replacement at build time for literal property accesses likeimport.meta.env.VITE_VAR, but doesn't create a runtime object that supports bracket notation with variables. This means environment variables in Vite, Astro, and SvelteKit will never be retrieved despite the PR's intent to fix this compatibility issue.

Fix in Cursor Fix in Web

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cursorcursor[bot]cursor[bot] left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@BYK@cursoragent

[8]ページ先頭

©2009-2025 Movatter.jp