From 1472c10bab3aa71a6efa9c70c6971cfb03dba006 Mon Sep 17 00:00:00 2001 From: "wuhao.daraw" Date: Tue, 26 Mar 2019 20:52:49 +0800 Subject: [PATCH] fix: electron enviroment detection --- src/shared/is_node.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/is_node.js b/src/shared/is_node.js index 937438662..1720edb13 100644 --- a/src/shared/is_node.js +++ b/src/shared/is_node.js @@ -15,9 +15,10 @@ /* globals module, process */ module.exports = function isNodeJS() { - // NW.js is a browser context, but copies some Node.js objects; see + // NW.js / Electron is a browser context, but copies some Node.js objects; see // http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context + // https://electronjs.org/docs/api/process#processversionselectron return typeof process === 'object' && process + '' === '[object process]' && - !process.versions['nw']; + !process.versions['nw'] && !process.versions['electron']; };