File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,20 @@ const domain = domainModule as typeof domainModule & { active: (domainModule.Dom
2323// During build, the main process is invoked by
2424// `node next build`
2525// and child processes are invoked as
26- // `node <path>/node_modules/jest-worker/build/workers/processChild.js`,
27- // whereas at runtime the process is invoked as
26+ // `node <path>/node_modules/.../jest-worker/processChild.js`.
27+ // The former is (obviously) easy to recognize, but the latter could happen at runtime as well. Fortunately, the main
28+ // process hits this file before any of the child processes do, so we're able to set an env variable which the child
29+ // processes can then check. During runtime, the main process is invoked as
2830// `node next start`
2931// or
30- // `node /var/runtime/index.js`.
31- const isBuild = new RegExp ( 'build' ) . test ( process . argv . toString ( ) ) ;
32+ // `node /var/runtime/index.js`,
33+ // so we never drop into the `if` in the first place.
34+ let isBuild ;
35+ if ( process . argv . includes ( 'build' ) || process . env . BUILD_PHASE ) {
36+ process . env . BUILD_PHASE = 'true' ;
37+ isBuild = true ;
38+ }
39+
3240const isVercel = ! ! process . env . VERCEL ;
3341
3442/** Inits the Sentry NextJS SDK on node. */
You can’t perform that action at this time.
0 commit comments