mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix: use same global to inject process.hrtime
This commit is contained in:
parent
989f6811c2
commit
e8f52bd383
@ -5,8 +5,8 @@ import { SLSTarget } from '../config'
|
|||||||
const polyfill = `
|
const polyfill = `
|
||||||
const exports = {};
|
const exports = {};
|
||||||
const module = { exports };
|
const module = { exports };
|
||||||
const global = { process: {} };
|
const global = typeof globalThis !== 'undefined' ? globalThis : "undefined" !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
||||||
const window = global;
|
global.process = global.process || {};
|
||||||
(function(){const o=Date.now(),t=()=>Date.now()-o;global.process.hrtime=o=>{const e=Math.floor(.001*(Date.now()-t())),n=.001*t();let a=Math.floor(n)+e,r=Math.floor(n%1*1e9);return o&&(a-=o[0],r-=o[1],r<0&&(a--,r+=1e9)),[a,r]};})();
|
(function(){const o=Date.now(),t=()=>Date.now()-o;global.process.hrtime=o=>{const e=Math.floor(.001*(Date.now()-t())),n=.001*t();let a=Math.floor(n)+e,r=Math.floor(n%1*1e9);return o&&(a-=o[0],r-=o[1],r<0&&(a--,r+=1e9)),[a,r]};})();
|
||||||
`
|
`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user