@@ -69,11 +69,6 @@ export function constructWebpackConfigFunction(
69
69
buildContext : BuildContext ,
70
70
) : WebpackConfigObject {
71
71
const { isServer, dev : isDev , dir : projectDir } = buildContext ;
72
- const webpackPluginOptions = getWebpackPluginOptions (
73
- buildContext ,
74
- userSentryWebpackPluginOptions ,
75
- userSentryOptions ,
76
- ) ;
77
72
78
73
let rawNewConfig = { ...incomingConfig } ;
79
74
@@ -88,7 +83,7 @@ export function constructWebpackConfigFunction(
88
83
const newConfig = setUpModuleRules ( rawNewConfig ) ;
89
84
90
85
// Add a loader which will inject code that sets global values
91
- addValueInjectionLoader ( newConfig , userNextConfig , userSentryOptions , webpackPluginOptions ) ;
86
+ addValueInjectionLoader ( newConfig , userNextConfig , userSentryOptions ) ;
92
87
93
88
if ( isServer ) {
94
89
if ( userSentryOptions . autoInstrumentServerFunctions !== false ) {
@@ -200,7 +195,11 @@ export function constructWebpackConfigFunction(
200
195
}
201
196
202
197
newConfig . plugins = newConfig . plugins || [ ] ;
203
- newConfig . plugins . push ( new SentryWebpackPlugin ( webpackPluginOptions ) ) ;
198
+ newConfig . plugins . push (
199
+ new SentryWebpackPlugin (
200
+ getWebpackPluginOptions ( buildContext , userSentryWebpackPluginOptions , userSentryOptions ) ,
201
+ ) ,
202
+ ) ;
204
203
}
205
204
206
205
return newConfig ;
@@ -529,9 +528,8 @@ export function getWebpackPluginOptions(
529
528
configFile : hasSentryProperties ? 'sentry.properties' : undefined ,
530
529
stripPrefix : [ 'webpack://_N_E/' ] ,
531
530
urlPrefix,
532
- // We don't want to inject the release using the webpack plugin because we're instead doing it via the prefix loader
533
- // combined with the release prefix loader template.
534
- entries : [ ] ,
531
+ entries : ( entryPointName : string ) =>
532
+ shouldAddSentryToEntryPoint ( entryPointName , isServer , userSentryOptions . excludeServerRoutes , isDev ) ,
535
533
release : getSentryRelease ( buildId ) ,
536
534
dryRun : isDev ,
537
535
} ) ;
@@ -655,32 +653,10 @@ function addValueInjectionLoader(
655
653
newConfig : WebpackConfigObjectWithModuleRules ,
656
654
userNextConfig : NextConfigObject ,
657
655
userSentryOptions : UserSentryOptions ,
658
- webpackPluginOptions : SentryWebpackPlugin . SentryCliPluginOptions ,
659
656
) : void {
660
657
const assetPrefix = userNextConfig . assetPrefix || userNextConfig . basePath || '' ;
661
- const releaseValue = webpackPluginOptions . release || process . env . SENTRY_RELEASE ;
662
- const orgValue = webpackPluginOptions . org || process . env . SENTRY_ORG ;
663
- const projectValue = webpackPluginOptions . project || process . env . SENTRY_PROJECT ;
664
658
665
659
const isomorphicValues = {
666
- // Inject release into SDK
667
- ...( releaseValue
668
- ? {
669
- SENTRY_RELEASE : {
670
- id : releaseValue ,
671
- } ,
672
- }
673
- : undefined ) ,
674
-
675
- // Enable module federation support (see https://github.com/getsentry/sentry-webpack-plugin/pull/307)
676
- ...( projectValue && releaseValue
677
- ? {
678
- SENTRY_RELEASES : {
679
- [ orgValue ? `${ projectValue } @${ orgValue } ` : projectValue ] : { id : releaseValue } ,
680
- } ,
681
- }
682
- : undefined ) ,
683
-
684
660
// `rewritesTunnel` set by the user in Next.js config
685
661
__sentryRewritesTunnelPath__ : userSentryOptions . tunnelRoute ,
686
662
} ;
0 commit comments