-
Notifications
You must be signed in to change notification settings - Fork 106
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
realFetch.call is not a function #15
Comments
that's strange. maybe node-fetch is not properly installed on your node_module. go to the /datalibrary/ and run |
I actually figured it out last night. It had to do with the way webpack was building the file. (I use webpack on the server-side too.) It was having trouble loading node-fetch in the right way. I was able to add node-fetch to the list of excludes and it solved the problem. If anyone else has a problem like this, then this will remain here for troubleshooting. |
Hi @lquixada, I'm currently facing the same issue. I upgraded from I'm using If I change the Looks like others have kinda the same problem with But I'm not sure how to fix this in our code. Perhaps it has something to do with your rollup build? |
Hi @alexvetter! I've identified the issue. The newer node-fetch version has two entry-points: main and module. When you require node files (without a bundler), it uses main. When you require bundled file (with target: node), it uses module. The module entry point uses es modules, thus the "default" property works. I'm already working on a solution. |
Thank you very much! I would hoped I could have been of more value for fixing that issue. Really appreciate your fast response! |
no problem! btw, can you do |
I should have been more clear. Yes, it works! Thanks again. Looking forward to a official release. |
'cause it runs into the same webpack bundling issue as described in lquixada/cross-fetch#15 (comment).
When I inspect the import using the developer tools, the realFetch is an object, and not a function. On this object, there is the fetch function.
I'm unsure if this is a problem with the library or some kind of weird artifact that I have with the build. It would seem to be the latter, but I can't track it down. Any idea why require('node-fetch') is returning an object?
The text was updated successfully, but these errors were encountered: