@@ -7,7 +7,7 @@ import * as path from 'path';
77
88const SENTRY_CLIENT_CONFIG_FILE = './sentry.client.config.js' ;
99const SENTRY_SERVER_CONFIG_FILE = './sentry.server.config.js' ;
10- // this is where the transpiled/bundled version of `USER_SERVER_CONFIG_FILE ` will end up
10+ // this is where the transpiled/bundled version of `SENTRY_SERVER_CONFIG_FILE ` will end up
1111export const SERVER_SDK_INIT_PATH = 'sentry/initServerSDK.js' ;
1212
1313// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -21,7 +21,7 @@ type WebpackConfig = {
2121 devtool : string ;
2222 plugins : PlainObject [ ] ;
2323 entry : EntryProperty ;
24- output : { path : string } ;
24+ output : { filename : string ; path : string } ;
2525 target : string ;
2626 context : string ;
2727} ;
@@ -156,7 +156,8 @@ export function withSentryConfig(
156156 // if we're building server code, store the webpack output path as an env variable, so we know where to look for the
157157 // webpack-processed version of `sentry.server.config.js` when we need it
158158 if ( config . target === 'node' ) {
159- const serverSDKInitOutputPath = path . join ( config . output . path , SERVER_SDK_INIT_PATH ) ;
159+ const outputLocation = path . dirname ( path . join ( config . output . path , config . output . filename ) ) ;
160+ const serverSDKInitOutputPath = path . join ( outputLocation , SERVER_SDK_INIT_PATH ) ;
160161 const projectDir = config . context ;
161162 setRuntimeEnvVars ( projectDir , {
162163 // ex: .next/server/sentry/initServerSdk.js
0 commit comments