mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +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 exports = {};
|
||||
const module = { exports };
|
||||
const global = { process: {} };
|
||||
const window = global;
|
||||
const global = typeof globalThis !== 'undefined' ? globalThis : "undefined" !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
||||
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]};})();
|
||||
`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user