-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Clone fails on Node: global.fetch is not a function #938
Comments
I’m not sure if I’m missing something, since no one else reports such an issue. So far I made it work by jury-rigging
|
The node version doesn't use |
@wmhilton I’m building an Electron one, and yes, this happens on Node process side. It does a Webpack pass during build🤔 I’m not aware if Webpack supplies |
Yes... it's really a webpack configuration issue. Webpack is probably trying to use the
Which 99% of the time is right, because Webpack is usually not used on Node.js apps. You can probably make Webpack use the "right" version with an Anyway, as you can see it's obviously a bit of a mess. And I am going to fix this in version 1.0 by pulling this troublesome bit out of the library completely and make users provide an HTTP client, just like what I already do for |
Understood, very clear. Going to take note but keep I guess Webpack is more for browser-based code, but this mainstream Electron builder library builds on top of Webpack to transpile/bundle both Node and in-browser code. Works impressively well out of the box but that Webpack config is not for the weak of heart (or subject to deadlines) to fiddle with (which I am so I don’t, unless something’s really broken). |
I have the same issue as well with a quite similar setup using rollup and deskgap. @wmhilton Maybe it would help to release a meta package for node usage (e.g. |
Hi @davidenke ! See if the solution I hit upon in v1.0.0 works for you. Basically the import * as git from 'isomorphic-git'
import http from 'isomorphic-git/http/node'
// or
import http from 'isomorphic-git/http/web' Full details and examples at https://isomorphic-git.org/docs/http |
@strogonoff ooh! what's the name of this mainstream Electron builder library that uses Webpack to transpile and bundle both? I was actually trying to do something similar the other day from scratch using Webpack (and failed miserably). |
@wmhilton I believe https://www.electron.build? That’s what we’re using! |
From a quick scan, it looks like as of this change in January 2019
http
module no longer checks forglobal.fetch
, which excludes Node environment.I was accidentally stuck on 0.50 version, and once I updated (for the sake of
fastCheckout
and other niceties) I’m getting the following stack trace when cloning:From cursory search, it seems like
global.fetch
isn’t supposed to be available on Node. Is reinstating the previous Node-compatible state ofhttp
’s fetching logic on the table?The text was updated successfully, but these errors were encountered: