js-ipfs-utils icon indicating copy to clipboard operation
js-ipfs-utils copied to clipboard

Defer to native-fetch whenever `ELECTRON_RUN_AS_NODE` is set

Open cjayross opened this issue 3 years ago • 7 comments

You guys are using electron-fetch whenever the is-electron package detects if it is running in an electron process (particularly, the main process). However, is-electron seems to be returning true even when in a process that has been forked from electron's main process as a node server.

This is currently what I am trying to set up in my own application, however, since you can't access electron from within a forked process, attempting to load electron-fetch results in an error wherein electron claims that it hasn't been installed properly.

The environment variable ELECTRON_RUN_AS_NODE is used to observe when a process is running as a fork from main, so I was thinking an additional condition could be added to defer to native-fetch whenever it is set.

cjayross avatar Aug 12 '21 15:08 cjayross