Skip to content

NodeJS and Electron conflict #82

Open
@xmaysonnave

Description

@xmaysonnave

Env:

  • Debian Buster
  • latest nvm
  • latest yarn
  • node v15
  • latest ipfs-core

I try to use js-ipfs while testing with NodeJS.
As a dependency of ipfs-core, ipfs-utils is installed (dev dependency)
https://github.com/ipfs/js-ipfs-utils/blob/master/src/http/fetch.js

This code check whether or not XMLHttpRequest is available in node and redirect to fetch.browser when available.
However my environment is node and ipfs-utils crashes as fetch.browser requires the global browser fetch.
I could suggest to enhance the initial statement with the following to redirect to fetch.node

if (typeof XMLHttpRequest === 'function' && typeof fetch === 'function') {
  module.exports = require('./fetch.browser')

Thanks

Metadata

Metadata

Assignees

Labels

kind/enhancementA net-new feature or improvement to an existing featurestatus/readyReady to be worked

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions