function resolveConfigForExecutionEnv() { if (configCache) { return configCache; } // NOTE: By using the "process.env.IS_NODE" flag here this block of code // will be removed when "process.env.IS_NODE === true". // If no "IS_NODE" env var is undefined we can assume that we are running outside // of a webpack run, and will therefore return the config file. if (typeof process.env.IS_NODE === 'undefined' || process.env.IS_NODE) { // i.e. running in our server/node process. configCache = require('../../../config').default; return configCache; } // To get here we are likely running in the browser. if (typeof window !== 'undefined' && typeof window.__CLIENT_CONFIG__ === 'object') { configCache = window.__CLIENT_CONFIG__; } else { // To get here we must be running in the browser. console.warn('No client configuration object was bound to the window.'); configCache = {}; } return configCache; }