Skip to content

Commit

Permalink
avoid double declare globals
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jun 12, 2023
1 parent 25cd8bc commit 5e4c3a6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/next/src/server/web/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ function enhanceGlobals() {

// to allow building code that import but does not use node.js modules,
// webpack will expect this function to exist in global scope
Object.defineProperty(globalThis, '__import_unsupported', {
value: __import_unsupported,
enumerable: false,
configurable: false,
})
if (!Object.hasOwn(globalThis, '__import_unsupported')) {
Object.defineProperty(globalThis, '__import_unsupported', {
value: __import_unsupported,
enumerable: false,
configurable: false,
})
}

// Eagerly fire instrumentation hook to make the startup faster.
void ensureInstrumentationRegistered()
Expand Down

0 comments on commit 5e4c3a6

Please sign in to comment.