Use is-electron package for accurate environment identification

This commit is contained in:
Ryo Narita
2021-10-05 13:42:05 +09:00
parent 1b2088c555
commit 01f230e448
3 changed files with 3 additions and 12 deletions

View File

@@ -1,16 +1,5 @@
/* eslint-disable */
// adapted from https://github.com/cheton/is-electron - (c) Cheton Wu
const isElectron = () => {
if (typeof window !== 'undefined' && typeof window.process === 'object') {
return true
}
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
return true
}
return false
}
const isElectron = require('is-electron')
const fs = (!isElectron() && (typeof window === 'object' || typeof self === 'object')) ? null : eval('require("fs")')