@@ -4,30 +4,30 @@ import { constructWebpackConfigFunction } from './webpack';
44/**
55 * Add Sentry options to the config to be exported from the user's `next.config.js` file.
66 *
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
88 * @param userSentryWebpackPluginOptions Configuration for SentryWebpackPlugin
99 * @returns The modified config to be exported
1010 */
1111export function withSentryConfig (
12- userNextConfig : ExportedNextConfig = { } ,
12+ exportedUserNextConfig : ExportedNextConfig = { } ,
1313 userSentryWebpackPluginOptions : Partial < SentryWebpackPluginOptions > = { } ,
1414) : NextConfigFunction | NextConfigObject {
1515 // If the user has passed us a function, we need to return a function, so that we have access to `phase` and
1616 // `defaults` in order to pass them along to the user's function
17- if ( typeof userNextConfig === 'function' ) {
17+ if ( typeof exportedUserNextConfig === 'function' ) {
1818 return function ( phase : string , defaults : { defaultConfig : NextConfigObject } ) : NextConfigObject {
19- const materializedUserNextConfig = userNextConfig ( phase , defaults ) ;
19+ const userNextConfigObject = exportedUserNextConfig ( phase , defaults ) ;
2020
2121 // Next 12.2.3+ warns about non-canonical properties on `userNextConfig`, so grab and then remove the `sentry`
2222 // property there. Where we actually need it is in the webpack config function we're going to create, so pass it
2323 // 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 ;
2626
2727 return {
28- ...materializedUserNextConfig ,
28+ ...userNextConfigObject ,
2929 webpack : constructWebpackConfigFunction (
30- materializedUserNextConfig ,
30+ userNextConfigObject ,
3131 userSentryWebpackPluginOptions ,
3232 userSentryOptions ,
3333 ) ,
@@ -39,11 +39,11 @@ export function withSentryConfig(
3939
4040 // Prevent nextjs from getting mad about having a non-standard config property in `userNextConfig`. (See note above
4141 // 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 ;
4444
4545 return {
46- ...userNextConfig ,
47- webpack : constructWebpackConfigFunction ( userNextConfig , userSentryWebpackPluginOptions , userSentryOptions ) ,
46+ ...exportedUserNextConfig ,
47+ webpack : constructWebpackConfigFunction ( exportedUserNextConfig , userSentryWebpackPluginOptions , userSentryOptions ) ,
4848 } ;
4949}
0 commit comments