In an electron app adding this line:
const { globSource } = require('ipfs-http-client');
causes this error message:
A JavaScript error occurred in the main process
Uncaught Exception:
ReferenceError: fetch is not defined
at Object../node_modules/ipfs-utils/src/http/fetch.browser.js (/home/marco/webMatters
/electronMatters/IPFSbase/.webpack/main/index.js:42149:28)
at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
at Object../node_modules/ipfs-utils/src/http.js (/home/marco/webMatters/electronMatters
/IPFSbase/.webpack/main/index.js:41661:37)
at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
at Object../node_modules/ipfs-utils/src/files/url-source.js (/home/marco/webMatters
/electronMatters/IPFSbase/.webpack/main/index.js:41604:14)
at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
at Object../node_modules/ipfs-http-client/src/index.js (/home/marco/webMatters/electronMatters
/IPFSbase/.webpack/main/index.js:38633:19)
at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
at Object../src/add-to-ipfs.js (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:74544:24)
at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
devDependencies:
"ipfs-or-gateway": "^2.1.0",
"electron": "^10.1.2",
dependencies:
"ipfs": "^0.53.1",
"ipfs-http-client": "^48.2.0",
"ipfsd-ctl": "^7.2.0",
"is-ipfs": "^2.0.0",
Other info:
node version: v14.5.0
O.S. : Ubuntu 18.04.4.Desktop
How to solve the problem?