Skip to content

Commit

Permalink
ensure build mode is not invoking register instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Aug 16, 2024
1 parent 490969e commit ed52baf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/next/src/server/web/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export async function getEdgeInstrumentationModule(): Promise<

let instrumentationModulePromise: Promise<any> | null = null
async function registerInstrumentation() {
// Ensure registerInstrumentation is not called in production build
if (process.env.NEXT_PHASE === 'phase-production-build') return
if (!instrumentationModulePromise) {
instrumentationModulePromise = getEdgeInstrumentationModule()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function register() {
console.log('register:' + process.env.NEXT_RUNTIME)
console.trace('register:' + process.env.NEXT_RUNTIME)
}

0 comments on commit ed52baf

Please sign in to comment.