Skip to content

Commit 60e443b

Browse files
authored
Browser throw process.env is undefined
1 parent 6df7bd3 commit 60e443b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/browser.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,14 @@ function load() {
214214

215215
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
216216
// process.env is undefined in sometimes, and it will throw a exception
217-
if (!r && typeof process !== 'undefined' && process.env) {
218-
r = process.env.DEBUG;
217+
try {
218+
if (!r && typeof process !== 'undefined' && 'env' in process) {
219+
r = process.env.DEBUG;
220+
}
221+
} catch(error) {
222+
// Browser throw `process.env is undefined`
219223
}
224+
220225

221226
return r;
222227
}

0 commit comments

Comments
 (0)