-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defer to native-fetch whenever ELECTRON_RUN_AS_NODE
is set
#140
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
ELECTRON_RUN_AS_NODE
is set
This sounds like it should be a PR to is-electron - have you opened an issue there? |
I considered that, but I believe that it's likely that this would be a breaking change there. |
Blocked for now: waiting for Node 16 to become LTS, and maybe even Electron to ship |
If anyone needs to have this issue fixed in the meantime, I have a branch with a workaround here: https://github.com/gatsby-tv/js-ipfs-utils One would only need to add the following to their {
"resolutions": {
"ipfs-utils": "https://github.com/gatsby-tv/js-ipfs-utils#fix/defer-to-native-fetch"
}
} |
Same issue here. This is also broken in workers. The electron.net API should only be used when Changing Line 8 in 5eecdcb
const IS_ELECTRON_MAIN = IS_ELECTRON && !IS_ENV_WITH_DOM && typeof process !== 'undefined' && process.type === "browser" should do the trick. |
@dkuhnert I don't see why the |
You guys are using
electron-fetch
whenever theis-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 tonative-fetch
whenever it is set.The text was updated successfully, but these errors were encountered: