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(
142142 // with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
143143 // try to build their apps.)
144144 ensureCLIBinaryExists ( ) &&
145+ // TODO: We might want to add detection for other non-prod environments
146+ ! isVercelNonProdEnv ( ) &&
145147 ( isServer ? ! userSentryOptions . disableServerWebpackPlugin : ! userSentryOptions . disableClientWebpackPlugin ) ;
146148
147149 if ( enableWebpackPlugin ) {
@@ -460,3 +462,9 @@ function ensureCLIBinaryExists(): boolean {
460462 }
461463 return false ;
462464}
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