Try to use process.env.NODE_ENV directly (#1402)
Support build processes that replace `process.env.NODE_ENV` with a constant string (such as webpack and Vite) by using `process.env.NODE_ENV` directly, instead of `globalThis.process && globalThis.process.env.NODE_ENV`, but do so inside a try/catch in case `process` is not defined. Co-authored-by: Daniel Huigens <d.huigens@protonmail.com>
This commit is contained in:
parent
fc42c38706
commit
df7e690469
|
@ -26,7 +26,12 @@
|
||||||
import * as stream from '@openpgp/web-stream-tools';
|
import * as stream from '@openpgp/web-stream-tools';
|
||||||
import { getBigInteger } from './biginteger';
|
import { getBigInteger } from './biginteger';
|
||||||
|
|
||||||
const debugMode = globalThis.process && globalThis.process.env.NODE_ENV === 'development';
|
const debugMode = (() => {
|
||||||
|
try {
|
||||||
|
return process.env.NODE_ENV === 'development'; // eslint-disable-line no-process-env
|
||||||
|
} catch (e) {}
|
||||||
|
return false;
|
||||||
|
})();
|
||||||
|
|
||||||
const util = {
|
const util = {
|
||||||
isString: function(data) {
|
isString: function(data) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user