diff --git a/src/utils/getEnvironment.js b/src/utils/getEnvironment.js index 3b4f100..03f5663 100644 --- a/src/utils/getEnvironment.js +++ b/src/utils/getEnvironment.js @@ -3,12 +3,12 @@ const isElectron = require('is-electron'); module.exports = (key) => { const env = {}; - if (isElectron()) { - env.type = 'electron'; + if (typeof WorkerGlobalScope !== 'undefined') { + env.type = 'webworker'; } else if (typeof window === 'object') { env.type = 'browser'; - } else if (typeof importScripts === 'function') { - env.type = 'webworker'; + } else if (isElectron()) { + env.type = 'electron'; } else if (typeof process === 'object' && typeof require === 'function') { env.type = 'node'; }