2018-03-17 20:33:00 +01:00
|
|
|
/* global __DEV__, localStorage */
|
2020-03-26 21:02:52 +01:00
|
|
|
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;
|
2018-03-17 21:39:21 +01:00
|
|
|
if (typeof __dirname === 'undefined') global.__dirname = '/';
|
|
|
|
if (typeof __filename === 'undefined') global.__filename = '';
|
2018-01-30 23:42:38 +01:00
|
|
|
if (typeof process === 'undefined') {
|
2018-03-17 21:39:21 +01:00
|
|
|
global.process = require('process');
|
2018-01-30 23:42:38 +01:00
|
|
|
} else {
|
2018-03-17 21:39:21 +01:00
|
|
|
const bProcess = require('process');
|
2021-05-08 08:41:45 +02:00
|
|
|
for (const p in bProcess) {
|
2018-01-30 23:42:38 +01:00
|
|
|
if (!(p in process)) {
|
2018-03-17 21:39:21 +01:00
|
|
|
process[p] = bProcess[p];
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-17 21:39:21 +01:00
|
|
|
process.browser = false;
|
2018-01-30 23:42:38 +01:00
|
|
|
|
|
|
|
// global.location = global.location || { port: 80 }
|
2018-03-17 21:39:21 +01:00
|
|
|
const isDev = typeof __DEV__ === 'boolean' && __DEV__;
|
2020-06-01 14:54:23 +02:00
|
|
|
process.env.NODE_ENV = isDev ? 'development' : 'production';
|
2018-01-30 23:42:38 +01:00
|
|
|
if (typeof localStorage !== 'undefined') {
|
2018-03-17 21:39:21 +01:00
|
|
|
localStorage.debug = isDev ? '*' : '';
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
2021-04-15 19:52:48 +02:00
|
|
|
|
|
|
|
// If using the crypto shim, uncomment the following line to ensure
|
|
|
|
// crypto is loaded first, so it can populate global.crypto
|
|
|
|
require('crypto');
|