File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -122,8 +122,16 @@ function migrateDeprecatedWebpackOptions(userSentryOptions: SentryBuildOptions):
122122 return newValue ?? deprecatedValue ;
123123 } ;
124124
125- const deprecatedMessage = ( deprecatedPath : string , newPath : string ) : string =>
126- `[@sentry/nextjs] DEPRECATION WARNING: ${ deprecatedPath } is deprecated and will be removed in a future version. Use ${ newPath } instead.` ;
125+ const deprecatedMessage = ( deprecatedPath : string , newPath : string ) : string => {
126+ const message = `[@sentry/nextjs] DEPRECATION WARNING: ${ deprecatedPath } is deprecated and will be removed in a future version. Use ${ newPath } instead.` ;
127+
128+ // In Turbopack builds, webpack configuration is not applied, so webpack-scoped options won't have any effect.
129+ if ( detectActiveBundler ( ) === 'turbopack' && newPath . startsWith ( 'webpack.' ) ) {
130+ return `${ message } (Not supported with Turbopack.)` ;
131+ }
132+
133+ return message ;
134+ } ;
127135
128136 /* eslint-disable deprecation/deprecation */
129137 // Migrate each deprecated option to the new path, but only if the new path isn't already set
Original file line number Diff line number Diff line change @@ -390,6 +390,21 @@ describe('withSentryConfig', () => {
390390 ) ;
391391 } ) ;
392392
393+ it ( 'adds a turbopack note when the deprecated option only applies to webpack' , ( ) => {
394+ process . env . TURBOPACK = '1' ;
395+ vi . spyOn ( util , 'getNextjsVersion' ) . mockReturnValue ( '16.0.0' ) ;
396+
397+ const sentryOptions = {
398+ disableLogger : true ,
399+ } ;
400+
401+ materializeFinalNextConfig ( exportedNextConfig , undefined , sentryOptions ) ;
402+
403+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
404+ expect . stringContaining ( 'Use webpack.treeshake.removeDebugLogging instead. (Not supported with Turbopack.)' ) ,
405+ ) ;
406+ } ) ;
407+
393408 it ( 'does not warn when using new webpack path' , ( ) => {
394409 delete process . env . TURBOPACK ;
395410
You can’t perform that action at this time.
0 commit comments