@@ -242,15 +242,17 @@ function getWebpackPluginOptions(
242
242
buildContext : BuildContext ,
243
243
userPluginOptions : Partial < SentryWebpackPluginOptions > ,
244
244
) : SentryWebpackPluginOptions {
245
- const { isServer, dir : projectDir , buildId, dev : isDev } = buildContext ;
245
+ const { isServer, dir : projectDir , buildId, dev : isDev , config : nextConfig } = buildContext ;
246
246
247
+ const isServerless = nextConfig . target === 'experimental-serverless-trace' ;
247
248
const hasSentryProperties = fs . existsSync ( path . resolve ( projectDir , 'sentry.properties' ) ) ;
248
249
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
+ ] ;
254
256
const clientInclude = [ { paths : [ '.next/static/chunks/pages' ] , urlPrefix : '~/_next/static/chunks/pages' } ] ;
255
257
256
258
const defaultPluginOptions = dropUndefinedKeys ( {
0 commit comments