Comments (5)
I suspect this is because I'm trying to use this in an npm module myself and I'm running it through a terminal window.
https://github.com/donavon/thwack/blob/master/src/default/index.js#L4-L6
This code would seem to suggest that you're only catering for this being used in a browser, given it's the lack of fetch
that causes that specific error.
from thwack.
Search the readme for nodejs. If you’re trying to use this in node, you must import it like import thwack from 'thwack/node';
(if using node 12+))
from thwack.
you must import it like import thwack from 'thwack/node';
Unfortunately that doesn't work if you are using Typescript. I end up with an import error. Same applies if I were to use thwack/core
as well.
Also, and this might be a noob question, if I do end up changing it to use thwack/node
, how will that affect anyone who may import my module?
from thwack.
You can always set fetch yourself. If you look at thwack/node
you'll see that it requires node-fetch
. You could do the same.
import thwack from 'thwack';
import fetch from 'node-fetch';
thwack.defaults.fetch = fetch;
from thwack.
That gives me an error saying:
I had tried this before using the ThwackOptions.fetch
which I think might have given the same issue.
from thwack.
Related Issues (9)
- vs developit/redaxios? HOT 3
- Abort requests in nodejs HOT 3
- Types aren't detected when importing thwack/node HOT 5
- Photos
- PATCH requests are blocked by CORS policy
- How can i cancel request, and listen to canceled event and use it with react hooks like logging example HOT 4
- ThwackResponse should consume data type HOT 8
- add all contributors bot HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thwack.