Skip to content

Commit 6691198

Browse files
committed
pass defaults to override check as an argument
1 parent d610997 commit 6691198

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export function constructWebpackConfigFunction(
8989
newConfig.devtool = 'source-map';
9090
}
9191

92-
checkWebpackPluginOverrides(userSentryWebpackPluginOptions);
92+
checkWebpackPluginOverrides(defaultSentryWebpackPluginOptions, userSentryWebpackPluginOptions);
9393

9494
newConfig.plugins = newConfig.plugins || [];
9595
newConfig.plugins.push(
@@ -199,13 +199,15 @@ function addFileToExistingEntryPoint(
199199
* our default options are getting overridden. (Note: If any of our default values is undefined, it won't be included in
200200
* the warning.)
201201
*
202-
* @param userSentryWebpackPluginOptions The user's SentryWebpackPlugin options
202+
* @param defaultOptions Default SentryWebpackPlugin options
203+
* @param userOptions The user's SentryWebpackPlugin options
203204
*/
204-
function checkWebpackPluginOverrides(userSentryWebpackPluginOptions: Partial<SentryWebpackPluginOptions>): void {
205+
function checkWebpackPluginOverrides(
206+
defaultOptions: SentryWebpackPluginOptions,
207+
userOptions: Partial<SentryWebpackPluginOptions>,
208+
): void {
205209
// warn if any of the default options for the webpack plugin are getting overridden
206-
const sentryWebpackPluginOptionOverrides = Object.keys(defaultSentryWebpackPluginOptions)
207-
.concat('dryrun')
208-
.filter(key => key in userSentryWebpackPluginOptions);
210+
const sentryWebpackPluginOptionOverrides = Object.keys(defaultOptions).filter(key => key in userOptions);
209211
if (sentryWebpackPluginOptionOverrides.length > 0) {
210212
logger.warn(
211213
'[Sentry] You are overriding the following automatically-set SentryWebpackPlugin config options:\n' +

0 commit comments

Comments
 (0)