Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Nuxt3 module & plugin #562

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Denoder
Copy link

@Denoder Denoder commented Feb 5, 2022

Applying what I did here: #536 (comment)
to the actual module.

@nklsw
Copy link

nklsw commented Mar 6, 2022

Would love to see this merged 👀

@d3473r
Copy link

d3473r commented Mar 16, 2022

@pi0 can you please take a look at this?
This is blocking me from starting a new nuxt3 project :/

EDIT: @aldarund @anteriovieira @atinux @codebender828 @danielroe @DavidBernal @dotneet @farnabaz @gaetansenn @hmsk @JulienTant @kevinmarrec @lihbr @limichange @lupas @manniL @mvrlin @NicoPennec @paulgv @pimlie @potato4d @qm3ster @ricardogobbosouza @sam3d @Tabrizian @vuchl @warriorBrian can someone please take a look?

@atinux
Copy link
Member

atinux commented Apr 4, 2022

Thank you for the PR @teranode

Actually this is more complex that it seems since in Nuxt 3 we do have direct function call when making local request to the server.

See more on https://v3.nuxtjs.org/docs/migration/component-options#isomorphic-fetch

What are the features that you need from axios that you cannot do with $fetch in Nuxt 3?

@Denoder
Copy link
Author

Denoder commented Apr 4, 2022

@atinux Wasn't about features that I needed, the auth module used this module to function, and the auth module itself is taking long to release so ended up having to convert that too.

https://github.com/Teranode/nuxt-module-alternatives

@Intevel
Copy link
Contributor

Intevel commented Apr 4, 2022

@teranode A new auth module for Nuxt 3 is planned in Q2 2022

@Denoder
Copy link
Author

Denoder commented Apr 4, 2022

@Intevel I am aware of that.

@pi0
Copy link
Member

pi0 commented Apr 4, 2022

@teranode Thanks for your initiative and efforts for Nuxt 3 compatibility of this module.

I'm the author of axios, proxy, and auth modules (as well as Nuxt3!). All 3 modules were deeply designed to work well with the Nuxt 2 server architecture and even if we make our best to make them "just working" with Nuxt 3, they are not close to Nuxt 3 compatibility. Base URL handling, ESM and fetch support (for non-node.js servers) are essentially missing features from the axios module.

Regardless, I agree, that we should have basic compatibility for popular modules like axios and proxy, making migration easier.

@Intevel
Copy link
Contributor

Intevel commented Apr 4, 2022

In general I think it would be too much work to update the auth-module to be Nuxt 3 compatible. I understand the idea, the axios module is the third most installed.

@Denoder
Copy link
Author

Denoder commented Apr 4, 2022

@pi0 It was a fun experience for me. On a side not, I do wonder how the proxy module will work considering that when using the function-based approach it wont work and had to resort to generating files inside the server folder (using the vite settings also had the same issue.).

@Intevel It works for the most part, there are a few bugs here and there (if people tell me what they are), the one glaring issue that I'm facing currently is that axios, pinia, and auth (or really any plugin that also has server sided capabilities) aren't available on the client side when using global middleware

@Denoder
Copy link
Author

Denoder commented Apr 4, 2022

fetch support (for non-node.js servers)

Also (besides nuxt3's built in functions) wouldn't nuxt/http work for that?
@pi0

@djames-rms
Copy link

djames-rms commented Apr 4, 2022

What are the features that you need from axios that you cannot do with $fetch in Nuxt 3?

@atinux it would nice for $fetch to have a global set token function like $axios has.

@Denoder
Copy link
Author

Denoder commented Apr 20, 2022

Should I close this, seeing as you are going to be using Nuxt's isomorphic fetch api?

@pi0
Copy link
Member

pi0 commented Apr 20, 2022

Hi @teranode. Please keep it open i would love to continue on your work for at least basic compatibility with Nuxt3. Sorry it took long. There was tons of other stuff to work on.

BTW yes, please consider using Nuxt 3 native fetch/$fetch whenever possible!

@bmulholland
Copy link

If we want to switch from axios to Nuxt 3 fetch, what do we need to change in our code? Where's the docs on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants