fix: fs shim electron check

This commit is contained in:
Kia Rahimian 2020-05-17 15:18:17 -04:00 committed by Mark Robert Henderson
parent 80fdf57cbe
commit 651d793e31

View File

@ -1,4 +1,17 @@
/* eslint-disable */ /* eslint-disable */
const fs = (typeof process !== 'object' && (typeof window === 'object' || typeof self === 'object')) ? null : eval('require("fs")') // 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 fs = (!isElectron() && (typeof window === 'object' || typeof self === 'object')) ? null : eval('require("fs")')
module.exports = fs module.exports = fs