Closed brandonpittman closed 4 years ago
As long as I don't include Axios in the modules list, everything works as expected.
@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?
@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.
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.
@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.
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.
Check the API configuration section here: https://github.com/joostdecock/nuxtdown-module/blob/master/README.md#api-configuration
nuxtdown has the same problem.
Checked the AJAX requests but they're going to the same place, it seems.
@brandonpittman Thanks for testing.
So, are you guys who use Nuxtdown just pulling in Axios on a per-component basis?
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
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 (?).
Is one of the first things I changed when starting the update, there is some progress but is slow. You can see the code on the development branch and is published here you can install it with npm i --save @dinamomx/nuxtent
No one cares about this.
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