Skip to content

Commit c04ecdc

Browse files
committed
fix env to work in electron correctly
The problem is: electron env includes and browser and nodejs together. Therefore, both isBrowser and isNodejs function will return true. The comment in the code mentions, that isBrowser is explictly called first to prevent electron renderer process to be initialized with wrong environment due to isNodejs() returning true. But current code (before the change) executes both isBrowser and isNodejs blocks. This commit resolves the issue.
1 parent 8609b25 commit c04ecdc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/env/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ function initialize() {
2222
// check for isBrowser() first to prevent electron renderer process
2323
// to be initialized with wrong environment due to isNodejs() returning true
2424
if (isBrowser()) {
25-
setEnv(createBrowserEnv())
25+
return setEnv(createBrowserEnv())
2626
}
2727
if (isNodejs()) {
28-
setEnv(createNodejsEnv())
28+
return setEnv(createNodejsEnv())
2929
}
3030
}
3131

0 commit comments

Comments
 (0)