@@ -73,11 +73,18 @@ export function withSentryConfig(
73
73
}
74
74
75
75
return {
76
- experimental : { plugins : true } ,
76
+ ...providedExports ,
77
+ experimental : { ...( providedExports . experimental || { } ) , plugins : true } ,
77
78
plugins : [ ...( providedExports . plugins || [ ] ) , '@sentry/next-plugin-sentry' ] ,
78
79
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 ) {
81
88
// Ensure quality source maps in production. (Source maps aren't uploaded in dev, and besides, Next doesn't let
82
89
// you change this is dev even if you want to - see
83
90
// https://github.com/vercel/next.js/blob/master/errors/improper-devtool.md.)
@@ -86,11 +93,12 @@ export function withSentryConfig(
86
93
config . plugins . push (
87
94
// TODO it's not clear how to do this better, but there *must* be a better way
88
95
new ( ( SentryWebpackPlugin as unknown ) as typeof defaultWebpackPlugin ) ( {
89
- dryRun : dev ,
96
+ dryRun : options . dev ,
90
97
...defaultWebpackPluginOptions ,
91
98
...providedWebpackPluginOptions ,
92
99
} ) ,
93
100
) ;
101
+
94
102
return config ;
95
103
} ,
96
104
} ;
0 commit comments