From a1ba86c766a5d0b274d9fa0aa673eebc6016067b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sun, 16 Apr 2023 16:06:24 +0200 Subject: [PATCH] fix(node:process): avoid recursive access --- src/runtime/node/process/_process.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/runtime/node/process/_process.ts b/src/runtime/node/process/_process.ts index bb939fe7..b9bbcc59 100644 --- a/src/runtime/node/process/_process.ts +++ b/src/runtime/node/process/_process.ts @@ -158,10 +158,9 @@ Item.prototype.run = function () { process.title = "unenv"; const _envShim = Object.create(null); +const _processEnv = globalThis.process?.env; const _getEnv = (useShim: boolean) => - globalThis.process?.env || - globalThis.__env__ || - (useShim ? _envShim : globalThis); + _processEnv || globalThis.__env__ || (useShim ? _envShim : globalThis); process.env = new Proxy(_envShim, { get(_, prop) {