@@ -686,24 +686,20 @@ export function getWebpackPluginOptions(
686686 userPluginOptions : Partial < SentryWebpackPluginOptions > ,
687687 userSentryOptions : UserSentryOptions ,
688688) : SentryWebpackPluginOptions {
689- const { buildId, isServer, webpack , config, dir : projectDir } = buildContext ;
689+ const { buildId, isServer, config, dir : projectDir } = buildContext ;
690690 const userNextConfig = config as NextConfigObject ;
691691
692692 const distDirAbsPath = path . resolve ( projectDir , userNextConfig . distDir || '.next' ) ; // `.next` is the default directory
693693
694- const isWebpack5 = webpack . version . startsWith ( '5' ) ;
695694 const isServerless = userNextConfig . target === 'experimental-serverless-trace' ;
696695 const hasSentryProperties = fs . existsSync ( path . resolve ( projectDir , 'sentry.properties' ) ) ;
697696 const urlPrefix = '~/_next' ;
698697
699698 const serverInclude = isServerless
700699 ? [ { paths : [ `${ distDirAbsPath } /serverless/` ] , urlPrefix : `${ urlPrefix } /serverless` } ]
701- : [
702- { paths : [ `${ distDirAbsPath } /server/pages/` ] , urlPrefix : `${ urlPrefix } /server/pages` } ,
703- { paths : [ `${ distDirAbsPath } /server/app/` ] , urlPrefix : `${ urlPrefix } /server/app` } ,
704- ] . concat (
705- isWebpack5 ? [ { paths : [ `${ distDirAbsPath } /server/chunks/` ] , urlPrefix : `${ urlPrefix } /server/chunks` } ] : [ ] ,
706- ) ;
700+ : [ { paths : [ `${ distDirAbsPath } /server/` ] , urlPrefix : `${ urlPrefix } /server` } ] ;
701+
702+ const serverIgnore : string [ ] = [ ] ;
707703
708704 const clientInclude = userSentryOptions . widenClientFileUpload
709705 ? [ { paths : [ `${ distDirAbsPath } /static/chunks` ] , urlPrefix : `${ urlPrefix } /static/chunks` } ]
@@ -712,15 +708,16 @@ export function getWebpackPluginOptions(
712708 { paths : [ `${ distDirAbsPath } /static/chunks/app` ] , urlPrefix : `${ urlPrefix } /static/chunks/app` } ,
713709 ] ;
714710
711+ // Widening the upload scope is necessarily going to lead to us uploading files we don't need to (ones which
712+ // don't include any user code). In order to lessen that where we can, exclude the internal nextjs files we know
713+ // will be there.
714+ const clientIgnore = userSentryOptions . widenClientFileUpload
715+ ? [ 'framework-*' , 'framework.*' , 'main-*' , 'polyfills-*' , 'webpack-*' ]
716+ : [ ] ;
717+
715718 const defaultPluginOptions = dropUndefinedKeys ( {
716719 include : isServer ? serverInclude : clientInclude ,
717- ignore :
718- isServer || ! userSentryOptions . widenClientFileUpload
719- ? [ ]
720- : // Widening the upload scope is necessarily going to lead to us uploading files we don't need to (ones which
721- // don't include any user code). In order to lessen that where we can, exclude the internal nextjs files we know
722- // will be there.
723- [ 'framework-*' , 'framework.*' , 'main-*' , 'polyfills-*' , 'webpack-*' ] ,
720+ ignore : isServer ? serverIgnore : clientIgnore ,
724721 url : process . env . SENTRY_URL ,
725722 org : process . env . SENTRY_ORG ,
726723 project : process . env . SENTRY_PROJECT ,
@@ -976,7 +973,7 @@ function addValueInjectionLoader(
976973
977974 newConfig . module . rules . push (
978975 {
979- test : / s e n t r y \. s e r v e r \. c o n f i g \. ( j s x ? | t s x ? ) / ,
976+ test : / s e n t r y \. ( s e r v e r | e d g e ) \. c o n f i g \. ( j s x ? | t s x ? ) / ,
980977 use : [
981978 {
982979 loader : path . resolve ( __dirname , 'loaders/valueInjectionLoader.js' ) ,
0 commit comments