@@ -108,63 +108,87 @@ function migrateDeprecatedWebpackOptions(userSentryOptions: SentryBuildOptions):
108108
109109 const webpack = userSentryOptions . webpack ;
110110
111- const withDeprecatedFallback = < T > ( newValue : T | undefined , deprecatedValue : T | undefined ) : T | undefined => {
111+ const withDeprecatedFallback = < T > (
112+ newValue : T | undefined ,
113+ deprecatedValue : T | undefined ,
114+ message : string ,
115+ ) : T | undefined => {
116+ if ( deprecatedValue !== undefined && deprecatedValue !== newValue ) {
117+ // eslint-disable-next-line no-console
118+ console . warn ( message ) ;
119+ }
120+
112121 return newValue ?? deprecatedValue ;
113122 } ;
114123
124+ const deprecatedMessage = ( deprecatedPath : string , newPath : string ) : string =>
125+ `[@sentry/nextjs] DEPRECATION WARNING: ${ deprecatedPath } is deprecated and will be removed in a future version. Use ${ newPath } instead.` ;
126+
115127 /* eslint-disable deprecation/deprecation */
116128 // Migrate each deprecated option to the new path, but only if the new path isn't already set
117129 webpack . autoInstrumentServerFunctions = withDeprecatedFallback (
118130 webpack . autoInstrumentServerFunctions ,
119131 userSentryOptions . autoInstrumentServerFunctions ,
132+ deprecatedMessage ( 'autoInstrumentServerFunctions' , 'webpack.autoInstrumentServerFunctions' ) ,
120133 ) ;
121134
122135 webpack . autoInstrumentMiddleware = withDeprecatedFallback (
123136 webpack . autoInstrumentMiddleware ,
124137 userSentryOptions . autoInstrumentMiddleware ,
138+ deprecatedMessage ( 'autoInstrumentMiddleware' , 'webpack.autoInstrumentMiddleware' ) ,
125139 ) ;
126140
127141 webpack . autoInstrumentAppDirectory = withDeprecatedFallback (
128142 webpack . autoInstrumentAppDirectory ,
129143 userSentryOptions . autoInstrumentAppDirectory ,
144+ deprecatedMessage ( 'autoInstrumentAppDirectory' , 'webpack.autoInstrumentAppDirectory' ) ,
130145 ) ;
131146
132147 webpack . excludeServerRoutes = withDeprecatedFallback (
133148 webpack . excludeServerRoutes ,
134149 userSentryOptions . excludeServerRoutes ,
150+ deprecatedMessage ( 'excludeServerRoutes' , 'webpack.excludeServerRoutes' ) ,
135151 ) ;
136152
137153 webpack . widenClientFileUpload = withDeprecatedFallback (
138154 webpack . widenClientFileUpload ,
139155 userSentryOptions . widenClientFileUpload ,
156+ deprecatedMessage ( 'widenClientFileUpload' , 'webpack.widenClientFileUpload' ) ,
140157 ) ;
141158
142159 webpack . unstable_sentryWebpackPluginOptions = withDeprecatedFallback (
143160 webpack . unstable_sentryWebpackPluginOptions ,
144161 userSentryOptions . unstable_sentryWebpackPluginOptions ,
162+ deprecatedMessage ( 'unstable_sentryWebpackPluginOptions' , 'webpack.unstable_sentryWebpackPluginOptions' ) ,
145163 ) ;
146164
147165 webpack . disableSentryConfig = withDeprecatedFallback (
148166 webpack . disableSentryConfig ,
149167 userSentryOptions . disableSentryWebpackConfig ,
168+ deprecatedMessage ( 'disableSentryWebpackConfig' , 'webpack.disableSentryConfig' ) ,
150169 ) ;
151170
152171 // Handle treeshake.debugLogs specially since it's nested
153172 if ( userSentryOptions . disableLogger !== undefined ) {
154173 webpack . treeshake = webpack . treeshake || { } ;
155- webpack . treeshake . debugLogs = withDeprecatedFallback ( webpack . treeshake . debugLogs , userSentryOptions . disableLogger ) ;
174+ webpack . treeshake . debugLogs = withDeprecatedFallback (
175+ webpack . treeshake . debugLogs ,
176+ userSentryOptions . disableLogger ,
177+ deprecatedMessage ( 'disableLogger' , 'webpack.treeshake.debugLogs' ) ,
178+ ) ;
156179 }
157180
158181 webpack . automaticVercelMonitors = withDeprecatedFallback (
159182 webpack . automaticVercelMonitors ,
160183 userSentryOptions . automaticVercelMonitors ,
184+ deprecatedMessage ( 'automaticVercelMonitors' , 'webpack.automaticVercelMonitors' ) ,
161185 ) ;
162186
163187 webpack . reactComponentAnnotation = withDeprecatedFallback (
164188 webpack . reactComponentAnnotation ,
165189 userSentryOptions . reactComponentAnnotation ,
190+ deprecatedMessage ( 'reactComponentAnnotation' , 'webpack.reactComponentAnnotation' ) ,
166191 ) ;
167- /* eslint-enable deprecation/deprecation */
168192}
169193
170194// Modify the materialized object form of the user's next config by deleting the `sentry` property and wrapping the
0 commit comments