@@ -686,24 +686,20 @@ export function getWebpackPluginOptions(
686
686
userPluginOptions : Partial < SentryWebpackPluginOptions > ,
687
687
userSentryOptions : UserSentryOptions ,
688
688
) : SentryWebpackPluginOptions {
689
- const { buildId, isServer, webpack , config, dir : projectDir } = buildContext ;
689
+ const { buildId, isServer, config, dir : projectDir } = buildContext ;
690
690
const userNextConfig = config as NextConfigObject ;
691
691
692
692
const distDirAbsPath = path . resolve ( projectDir , userNextConfig . distDir || '.next' ) ; // `.next` is the default directory
693
693
694
- const isWebpack5 = webpack . version . startsWith ( '5' ) ;
695
694
const isServerless = userNextConfig . target === 'experimental-serverless-trace' ;
696
695
const hasSentryProperties = fs . existsSync ( path . resolve ( projectDir , 'sentry.properties' ) ) ;
697
696
const urlPrefix = '~/_next' ;
698
697
699
698
const serverInclude = isServerless
700
699
? [ { 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 [ ] = [ ] ;
707
703
708
704
const clientInclude = userSentryOptions . widenClientFileUpload
709
705
? [ { paths : [ `${ distDirAbsPath } /static/chunks` ] , urlPrefix : `${ urlPrefix } /static/chunks` } ]
@@ -712,15 +708,16 @@ export function getWebpackPluginOptions(
712
708
{ paths : [ `${ distDirAbsPath } /static/chunks/app` ] , urlPrefix : `${ urlPrefix } /static/chunks/app` } ,
713
709
] ;
714
710
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
+
715
718
const defaultPluginOptions = dropUndefinedKeys ( {
716
719
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 ,
724
721
url : process . env . SENTRY_URL ,
725
722
org : process . env . SENTRY_ORG ,
726
723
project : process . env . SENTRY_PROJECT ,
@@ -976,7 +973,7 @@ function addValueInjectionLoader(
976
973
977
974
newConfig . module . rules . push (
978
975
{
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 ? ) / ,
980
977
use : [
981
978
{
982
979
loader : path . resolve ( __dirname , 'loaders/valueInjectionLoader.js' ) ,
0 commit comments