@@ -73,11 +73,18 @@ export function withSentryConfig(
7373 }
7474
7575 return {
76- experimental : { plugins : true } ,
76+ ...providedExports ,
77+ experimental : { ...( providedExports . experimental || { } ) , plugins : true } ,
7778 plugins : [ ...( providedExports . plugins || [ ] ) , '@sentry/next-plugin-sentry' ] ,
7879 productionBrowserSourceMaps : true ,
79- webpack : ( config , { dev } ) => {
80- if ( ! dev ) {
80+ webpack : ( originalConfig , options ) => {
81+ let config = originalConfig ;
82+
83+ if ( typeof providedExports . webpack === 'function' ) {
84+ config = providedExports . webpack ( originalConfig , options ) ;
85+ }
86+
87+ if ( ! options . dev ) {
8188 // Ensure quality source maps in production. (Source maps aren't uploaded in dev, and besides, Next doesn't let
8289 // you change this is dev even if you want to - see
8390 // https://github.com/vercel/next.js/blob/master/errors/improper-devtool.md.)
@@ -86,11 +93,12 @@ export function withSentryConfig(
8693 config . plugins . push (
8794 // TODO it's not clear how to do this better, but there *must* be a better way
8895 new ( ( SentryWebpackPlugin as unknown ) as typeof defaultWebpackPlugin ) ( {
89- dryRun : dev ,
96+ dryRun : options . dev ,
9097 ...defaultWebpackPluginOptions ,
9198 ...providedWebpackPluginOptions ,
9299 } ) ,
93100 ) ;
101+
94102 return config ;
95103 } ,
96104 } ;
0 commit comments