let result ; if ( typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator . userAgent . indexOf ( 'Electron' ) > - 1 ) { const electron = window [ 'require' ] ( 'electron' ) ; result = electron . remote . require as NodeRequire ; } else if ( typeof process !== 'undefined' && ! ! module [ 'require' ] ) { result = require ; } else { result = ( ( ) => new Proxy ( { } , { get ( ) { throw new Error ( 'This platform is not supported' ) ; } , set ( ) { throw new Error ( 'This platform is not supported' ) ; } } ) ) as unknown as NodeRequire ; } export const requireLocal = result ;