Nuxtent cannot load pages when @nuxtjs/axios is registered as a module

brandonpittman
0
brandonpittman
commented 22 days ago

Version

1.4.1

Reproduction link

https://github.com/brandonpittman/nuxtent-module/blob/master/examples/multiple-content-types/nuxt.config.js

Steps to reproduce

Add '@nuxtjs/axios' to nuxt.config.js

What is expected ?

Should display content files

What is actually happening?

Can't find page

bug
0
brandonpittman
0
brandonpittman
commented 22 days ago

As long as I don't include Axios in the modules list, everything works as expected.

0
renestalder
5
renestalder
commented 22 days ago

@brandonpittman Could you elaborate what you mean by "Nuxtent cannot load pages"? Do you have build errors? Do you have run-time errors? What are the error messages?

0
brandonpittman
0
brandonpittman
commented 22 days ago

@brandonpittman Could you elaborate what you mean by "Nuxtent cannot load pages"? Do you have build errors? Do you have run-time errors? What are the error messages?

404s.

0
brandonpittman
0
brandonpittman
commented 22 days ago

None of the examples in the repo here have @nuxtjs/axios declared as a module. If you do, you might just see what I mean. I tried it with the example repo, and it did the same thing.

0
renestalder
5
renestalder
commented 22 days ago

@brandonpittman Ah, okay, I see. I probably never used Axios with it.

Just out of personal curiosity, I would be interested if you have the same problems with Nuxtdown.
https://github.com/joostdecock/nuxtdown-module

Basically a fork that fixed some major issues and I used that fork for my projects as long as those major issues exist in Nuxtent.

0
joostdecock
230
joostdecock
commented 22 days ago

This is from the top of my head, and I'm on my phone, so take it with a grain of salt:

If you're using axios in your own project, you need to be careful to keep two different instances with their own configuration. If you mix them up, nuxtent won't be able olto connect to the content-api.

A quick way to check is to open your browser development tools, and check the AJAX requests. Where are they going, and what's the response? That should guide you to where the problem lies.

0
joostdecock
230
joostdecock
commented 22 days ago
0
brandonpittman
0
brandonpittman
commented 22 days ago

nuxtdown has the same problem.

Checked the AJAX requests but they're going to the same place, it seems.

0
renestalder
5
renestalder
commented 22 days ago

@brandonpittman Thanks for testing.

1
brandonpittman
0
brandonpittman
commented 22 days ago

So, are you guys who use Nuxtdown just pulling in Axios on a per-component basis?

0
joostdecock
230
joostdecock
commented 22 days ago

Here's an example of a repo that uses nuxtdown and axios for other things: https://github.com/freesewing/site/blob/develop/nuxt/plugins/fs.js

1
ptdev
3
ptdev
commented 9 days ago

This is helpful but (imho) it's this module that should be using an isolated instance of the axios configuration instead of having it break the default axios configuration.

As it stands now, if one needs to use the official @nuxtjs/axios module for other purposes, then setting it up according to the documentation will break the content api.

I think this module should either reuse the axios configuration defined on nuxt.config.js (if available) or ideally just use a completely isolated instance where we can setup every axios parameters in the module's configuration instead of just baseURL and browserBaseURL.

This would also allow, for example, to be able to change the "content-api" prefix on this module's configuration, which currently isn't possible AFAIK (?).

0
Informations
Bug Report โ€ข Open
#c142 - Created 22 days ago