Giter Site home page Giter Site logo

Comments (5)

ScottIsAFool avatar ScottIsAFool commented on May 24, 2024

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.

ryhinchey avatar ryhinchey commented on May 24, 2024

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.

ScottIsAFool avatar ScottIsAFool commented on May 24, 2024

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.

donavon avatar donavon commented on May 24, 2024

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.

ScottIsAFool avatar ScottIsAFool commented on May 24, 2024

That gives me an error saying:
image

I had tried this before using the ThwackOptions.fetch which I think might have given the same issue.

from thwack.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.