import { isNodeJSEnv } from './is-nodejs-env' ; if ( isNodeJSEnv && ! ( global as any ) . PerformanceObserver && ! ( global as any ) . performance && module && typeof module . require === 'function' ) { param pkg const dynamicRequire = ( mod , pkg ) : any => { return mod . require ( pkg ) ; } ; try { const { PerformanceObserver , performance } = dynamicRequire ( module , 'perf_hooks' ) ; ( global as any ) . PerformanceObserver = PerformanceObserver ; ( global as any ) . performance = performance ; } catch ( error ) { throw new Error ( `Your NodeJS application doesn't support 'perf_hooks'. ${ error }` ) ; } }