GithubHelp home page GithubHelp logo

Comments (8)

barbalex avatar barbalex commented on July 19, 2024 4

Same happens for anyone who uses gatsbyjs

from redaxios.

developit avatar developit commented on July 19, 2024 1

@kevlened apologies for the delay, version 0.3.0 is now published and includes this fix.

from redaxios.

developit avatar developit commented on July 19, 2024

Yes. Under node, use axios.

from redaxios.

andreisocaciu avatar andreisocaciu commented on July 19, 2024

I'm in the browser, but Next.js apps are server-side rendered.

from redaxios.

developit avatar developit commented on July 19, 2024

There are two solutions here:

  1. Publish redaxios with a browser field and point main at the axios package. I'm open to this and will give it a try next week.

  2. Use Webpack aliases to automatically load "redaxios" instead of "axios", but only in browser bundles:

// next.config.js
module.exports = {
  webpack(config, env) {
    if (!env.ssr) {
      config.resolve.alias.axios = 'redaxios';
    }
  }
}

from redaxios.

kevlened avatar kevlened commented on July 19, 2024

I forked to get this working in sapper.

yarn add kevlened/redaxios

from redaxios.

developit avatar developit commented on July 19, 2024

@barbalex in Gatsby you should never be using Redaxios on the server (or during prerendering). It must be aliased to axios, since redaxios is not a Node HTTP library.

from redaxios.

barbalex avatar barbalex commented on July 19, 2024

@developit yes. And that is important to know for gatsby users that would use it server side.

Unfortunately gatsby causes redaxios to run server side while building the app, even when it is used only client side. Which will probably be the case for most gatsby users using redaxios and is so in our case.

Anyway: v0.3.0 solves the issue. Thanks a lot!

from redaxios.

Related Issues (20)

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.