@@ -4,30 +4,30 @@ import { constructWebpackConfigFunction } from './webpack';
4
4
/**
5
5
* Add Sentry options to the config to be exported from the user's `next.config.js` file.
6
6
*
7
- * @param userNextConfig The existing config to be exported prior to adding Sentry
7
+ * @param exportedUserNextConfig The existing config to be exported prior to adding Sentry
8
8
* @param userSentryWebpackPluginOptions Configuration for SentryWebpackPlugin
9
9
* @returns The modified config to be exported
10
10
*/
11
11
export function withSentryConfig (
12
- userNextConfig : ExportedNextConfig = { } ,
12
+ exportedUserNextConfig : ExportedNextConfig = { } ,
13
13
userSentryWebpackPluginOptions : Partial < SentryWebpackPluginOptions > = { } ,
14
14
) : NextConfigFunction | NextConfigObject {
15
15
// If the user has passed us a function, we need to return a function, so that we have access to `phase` and
16
16
// `defaults` in order to pass them along to the user's function
17
- if ( typeof userNextConfig === 'function' ) {
17
+ if ( typeof exportedUserNextConfig === 'function' ) {
18
18
return function ( phase : string , defaults : { defaultConfig : NextConfigObject } ) : NextConfigObject {
19
- const materializedUserNextConfig = userNextConfig ( phase , defaults ) ;
19
+ const userNextConfigObject = exportedUserNextConfig ( phase , defaults ) ;
20
20
21
21
// Next 12.2.3+ warns about non-canonical properties on `userNextConfig`, so grab and then remove the `sentry`
22
22
// property there. Where we actually need it is in the webpack config function we're going to create, so pass it
23
23
// to `constructWebpackConfigFunction` so that it will be in the created function's closure.
24
- const { sentry : userSentryOptions } = materializedUserNextConfig ;
25
- delete materializedUserNextConfig . sentry ;
24
+ const { sentry : userSentryOptions } = userNextConfigObject ;
25
+ delete userNextConfigObject . sentry ;
26
26
27
27
return {
28
- ...materializedUserNextConfig ,
28
+ ...userNextConfigObject ,
29
29
webpack : constructWebpackConfigFunction (
30
- materializedUserNextConfig ,
30
+ userNextConfigObject ,
31
31
userSentryWebpackPluginOptions ,
32
32
userSentryOptions ,
33
33
) ,
@@ -39,11 +39,11 @@ export function withSentryConfig(
39
39
40
40
// Prevent nextjs from getting mad about having a non-standard config property in `userNextConfig`. (See note above
41
41
// for a more thorough explanation of what we're doing here.)
42
- const { sentry : userSentryOptions } = userNextConfig ;
43
- delete userNextConfig . sentry ;
42
+ const { sentry : userSentryOptions } = exportedUserNextConfig ;
43
+ delete exportedUserNextConfig . sentry ;
44
44
45
45
return {
46
- ...userNextConfig ,
47
- webpack : constructWebpackConfigFunction ( userNextConfig , userSentryWebpackPluginOptions , userSentryOptions ) ,
46
+ ...exportedUserNextConfig ,
47
+ webpack : constructWebpackConfigFunction ( exportedUserNextConfig , userSentryWebpackPluginOptions , userSentryOptions ) ,
48
48
} ;
49
49
}
0 commit comments