Skip to content

Commit

Permalink
chore: uses globalThis since webpack does not alter it
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed Jul 19, 2022
1 parent 8eefc63 commit 85445fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/next/build/webpack/plugins/middleware-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function handleWebpackExtenalForEdgeRuntime({
contextInfo: any
}) {
if (contextInfo.issuerLayer === 'middleware' && isNodeJsModule(request)) {
return `root __import_unsupported('${request}')`
return `root globalThis.__import_unsupported('${request}')`
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/web/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export 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(global, '__import_unsupported', {
Object.defineProperty(globalThis, '__import_unsupported', {
value: __import_unsupported,
enumerable: false,
configurable: false,
Expand Down

0 comments on commit 85445fe

Please sign in to comment.