From 709611941be45c41e801d7ecfa3b9dfeafcc6e44 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 19 Feb 2021 15:11:13 +0100 Subject: [PATCH] fix: use globalThis for client plugin --- packages/nitro/src/runtime/app/nitro.client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nitro/src/runtime/app/nitro.client.js b/packages/nitro/src/runtime/app/nitro.client.js index 4212c21438..bb02fa8030 100644 --- a/packages/nitro/src/runtime/app/nitro.client.js +++ b/packages/nitro/src/runtime/app/nitro.client.js @@ -1,7 +1,8 @@ +import _global from '@nuxt/un/runtime/global' import { $fetch } from 'ohmyfetch' -global.process = global.process || {}; +_global.process = _global.process || {}; -(function () { const o = Date.now(); const t = () => Date.now() - o; global.process.hrtime = global.process.hrtime || ((o) => { const e = Math.floor(0.001 * (Date.now() - t())); const a = 0.001 * t(); let l = Math.floor(a) + e; let n = Math.floor(a % 1 * 1e9); return o && (l -= o[0], n -= o[1], n < 0 && (l--, n += 1e9)), [l, n] }) })() +(function () { const o = Date.now(); const t = () => Date.now() - o; _global.process.hrtime = _global.process.hrtime || ((o) => { const e = Math.floor(0.001 * (Date.now() - t())); const a = 0.001 * t(); let l = Math.floor(a) + e; let n = Math.floor(a % 1 * 1e9); return o && (l -= o[0], n -= o[1], n < 0 && (l--, n += 1e9)), [l, n] }) })() global.$fetch = $fetch