@@ -69,11 +69,6 @@ export function constructWebpackConfigFunction(
6969 buildContext : BuildContext ,
7070 ) : WebpackConfigObject {
7171 const { isServer, dev : isDev , dir : projectDir } = buildContext ;
72- const webpackPluginOptions = getWebpackPluginOptions (
73- buildContext ,
74- userSentryWebpackPluginOptions ,
75- userSentryOptions ,
76- ) ;
7772
7873 let rawNewConfig = { ...incomingConfig } ;
7974
@@ -88,7 +83,7 @@ export function constructWebpackConfigFunction(
8883 const newConfig = setUpModuleRules ( rawNewConfig ) ;
8984
9085 // Add a loader which will inject code that sets global values
91- addValueInjectionLoader ( newConfig , userNextConfig , userSentryOptions , webpackPluginOptions ) ;
86+ addValueInjectionLoader ( newConfig , userNextConfig , userSentryOptions ) ;
9287
9388 if ( isServer ) {
9489 if ( userSentryOptions . autoInstrumentServerFunctions !== false ) {
@@ -200,7 +195,11 @@ export function constructWebpackConfigFunction(
200195 }
201196
202197 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+ ) ;
204203 }
205204
206205 return newConfig ;
@@ -529,9 +528,8 @@ export function getWebpackPluginOptions(
529528 configFile : hasSentryProperties ? 'sentry.properties' : undefined ,
530529 stripPrefix : [ 'webpack://_N_E/' ] ,
531530 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 ) ,
535533 release : getSentryRelease ( buildId ) ,
536534 dryRun : isDev ,
537535 } ) ;
@@ -655,32 +653,10 @@ function addValueInjectionLoader(
655653 newConfig : WebpackConfigObjectWithModuleRules ,
656654 userNextConfig : NextConfigObject ,
657655 userSentryOptions : UserSentryOptions ,
658- webpackPluginOptions : SentryWebpackPlugin . SentryCliPluginOptions ,
659656) : void {
660657 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 ;
664658
665659 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-
684660 // `rewritesTunnel` set by the user in Next.js config
685661 __sentryRewritesTunnelPath__ : userSentryOptions . tunnelRoute ,
686662 } ;
0 commit comments