@@ -242,15 +242,17 @@ function getWebpackPluginOptions(
242242 buildContext : BuildContext ,
243243 userPluginOptions : Partial < SentryWebpackPluginOptions > ,
244244) : SentryWebpackPluginOptions {
245- const { isServer, dir : projectDir , buildId, dev : isDev } = buildContext ;
245+ const { isServer, dir : projectDir , buildId, dev : isDev , config : nextConfig } = buildContext ;
246246
247+ const isServerless = nextConfig . target === 'experimental-serverless-trace' ;
247248 const hasSentryProperties = fs . existsSync ( path . resolve ( projectDir , 'sentry.properties' ) ) ;
248249
249- const serverInclude = [
250- { paths : [ '.next/server/chunks/' ] , urlPrefix : '~/_next/server/chunks' } ,
251- { paths : [ '.next/server/pages/' ] , urlPrefix : '~/_next/server/pages' } ,
252- { paths : [ '.next/serverless/' ] , urlPrefix : '~/_next/serverless' } ,
253- ] ;
250+ const serverInclude = isServerless
251+ ? [ { paths : [ '.next/serverless/' ] , urlPrefix : '~/_next/serverless' } ]
252+ : [
253+ { paths : [ '.next/server/chunks/' ] , urlPrefix : '~/_next/server/chunks' } ,
254+ { paths : [ '.next/server/pages/' ] , urlPrefix : '~/_next/server/pages' } ,
255+ ] ;
254256 const clientInclude = [ { paths : [ '.next/static/chunks/pages' ] , urlPrefix : '~/_next/static/chunks/pages' } ] ;
255257
256258 const defaultPluginOptions = dropUndefinedKeys ( {
0 commit comments