diff --git a/src/shared/is_node.js b/src/shared/is_node.js index 1ab845300..937438662 100644 --- a/src/shared/is_node.js +++ b/src/shared/is_node.js @@ -15,5 +15,9 @@ /* globals module, process */ module.exports = function isNodeJS() { - return typeof process === 'object' && process + '' === '[object process]'; + // NW.js 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 + return typeof process === 'object' && + process + '' === '[object process]' && + !process.versions['nw']; };