File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
packages/nextjs/src/config Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ export function constructWebpackConfigFunction(
142
142
// with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
143
143
// try to build their apps.)
144
144
ensureCLIBinaryExists ( ) &&
145
+ // TODO: We might want to add detection for other non-prod environments
146
+ ! isVercelNonProdEnv ( ) &&
145
147
( isServer ? ! userSentryOptions . disableServerWebpackPlugin : ! userSentryOptions . disableClientWebpackPlugin ) ;
146
148
147
149
if ( enableWebpackPlugin ) {
@@ -460,3 +462,9 @@ function ensureCLIBinaryExists(): boolean {
460
462
}
461
463
return false ;
462
464
}
465
+
466
+ /** Detect whether this build is part of a prod deployment on vercel, in order to decide whether to run the webpack
467
+ * plugin */
468
+ function isVercelNonProdEnv ( ) : boolean {
469
+ return process . env . VERCEL_ENV === 'preview' || process . env . VERCEL_ENV === 'development' ;
470
+ }
You can’t perform that action at this time.
0 commit comments