File tree Expand file tree Collapse file tree 5 files changed +11
-22
lines changed
Expand file tree Collapse file tree 5 files changed +11
-22
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
4343 _sentryBasePath ?: string ;
4444 _sentryRelease ?: string ;
4545 _experimentalThirdPartyOriginStackFrames ?: string ;
46- _sentrySpotlight ?: string ;
4746} ;
4847
4948// Treeshakable guard to remove all code related to tracing
@@ -144,9 +143,9 @@ function getDefaultIntegrations(options: BrowserOptions): Integration[] {
144143 ) ;
145144
146145 // Auto-enable Spotlight from NEXT_PUBLIC_SENTRY_SPOTLIGHT env var
147- // The value is injected at build time via the valueInjectionLoader because
148- // our SDK code in node_modules is not processed by Next.js DefinePlugin
149- const spotlightEnvValue = globalWithInjectedValues . _sentrySpotlight ;
146+ // The value is injected at build time via buildTimeVariables in withSentryConfig
147+ // following the same pattern as _sentryRelease
148+ const spotlightEnvValue = process . env . _sentrySpotlight ;
150149 if ( spotlightEnvValue !== undefined && options . spotlight === undefined ) {
151150 const boolValue = envToBool ( spotlightEnvValue , { strict : true } ) ;
152151 const spotlightConfig = boolValue !== null ? boolValue : spotlightEnvValue ;
Original file line number Diff line number Diff line change @@ -45,7 +45,6 @@ export function constructTurbopackConfig({
4545 routeManifest,
4646 nextJsVersion,
4747 tunnelPath,
48- userNextConfig,
4948 } ) ;
5049
5150 for ( const { matcher, rule } of valueInjectionRules ) {
Original file line number Diff line number Diff line change 11import * as path from 'path' ;
22import type { RouteManifest } from '../manifest/types' ;
3- import type { JSONValue , NextConfigObject , TurbopackMatcherWithRule } from '../types' ;
3+ import type { JSONValue , TurbopackMatcherWithRule } from '../types' ;
44
55/**
66 * Generate the value injection rules for client and server in turbopack config.
@@ -9,12 +9,10 @@ export function generateValueInjectionRules({
99 routeManifest,
1010 nextJsVersion,
1111 tunnelPath,
12- userNextConfig,
1312} : {
1413 routeManifest ?: RouteManifest ;
1514 nextJsVersion ?: string ;
1615 tunnelPath ?: string ;
17- userNextConfig ?: NextConfigObject ;
1816} ) : TurbopackMatcherWithRule [ ] {
1917 const rules : TurbopackMatcherWithRule [ ] = [ ] ;
2018 const isomorphicValues : Record < string , JSONValue > = { } ;
@@ -30,14 +28,6 @@ export function generateValueInjectionRules({
3028 clientValues . _sentryRouteManifest = JSON . stringify ( routeManifest ) ;
3129 }
3230
33- // Inject Spotlight config from NEXT_PUBLIC_SENTRY_SPOTLIGHT
34- // Turbopack is only used in dev mode, so we always inject this
35- // We check both userNextConfig.env (from next.config.js) and process.env (from .env files or shell)
36- const spotlightValue = userNextConfig ?. env ?. NEXT_PUBLIC_SENTRY_SPOTLIGHT ?? process . env . NEXT_PUBLIC_SENTRY_SPOTLIGHT ;
37- if ( spotlightValue ) {
38- clientValues . _sentrySpotlight = spotlightValue ;
39- }
40-
4131 // Inject tunnel route path for both client and server
4232 if ( tunnelPath ) {
4333 isomorphicValues . _sentryRewritesTunnelPath = tunnelPath ;
Original file line number Diff line number Diff line change @@ -763,12 +763,6 @@ function addValueInjectionLoader({
763763 ? 'true'
764764 : undefined ,
765765 _sentryRouteManifest : JSON . stringify ( routeManifest ) ,
766- // Inject Spotlight config from NEXT_PUBLIC_SENTRY_SPOTLIGHT (only in dev mode)
767- // This is needed because our SDK code in node_modules is not processed by Next.js DefinePlugin
768- // We check both userNextConfig.env (from next.config.js) and process.env (from .env files or shell)
769- _sentrySpotlight : buildContext . dev
770- ? ( userNextConfig . env ?. NEXT_PUBLIC_SENTRY_SPOTLIGHT ?? process . env . NEXT_PUBLIC_SENTRY_SPOTLIGHT )
771- : undefined ,
772766 } ;
773767
774768 if ( buildContext . isServer ) {
Original file line number Diff line number Diff line change @@ -520,6 +520,13 @@ function setUpBuildTimeVariables(
520520 buildTimeVariables . _sentryRelease = releaseName ;
521521 }
522522
523+ // Inject Spotlight config from NEXT_PUBLIC_SENTRY_SPOTLIGHT env var
524+ // We check both userNextConfig.env (from next.config.js) and process.env (from .env files or shell)
525+ const spotlightValue = userNextConfig . env ?. NEXT_PUBLIC_SENTRY_SPOTLIGHT ?? process . env . NEXT_PUBLIC_SENTRY_SPOTLIGHT ;
526+ if ( spotlightValue ) {
527+ buildTimeVariables . _sentrySpotlight = spotlightValue ;
528+ }
529+
523530 if ( typeof userNextConfig . env === 'object' ) {
524531 userNextConfig . env = { ...buildTimeVariables , ...userNextConfig . env } ;
525532 } else if ( userNextConfig . env === undefined ) {
You can’t perform that action at this time.
0 commit comments