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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt 3 Support #130

Open
harlan-zw opened this issue Sep 11, 2023 · 10 comments
Open

Nuxt 3 Support #130

harlan-zw opened this issue Sep 11, 2023 · 10 comments

Comments

@harlan-zw
Copy link
Contributor

Hey 馃憢 It looks like this module hasn't been updated for Nuxt 3. In an effort to improve the developer experience of modules, I've updated the module to clarify that it only supports Nuxt 2.

Alternatives:

  • In Nuxt 3 redirects are supported out of the box through Route Rules, this module may not be needed.
export default defineNuxtConfig({
  routeRules: {
   // Redirects legacy urls
    '/old-page': { redirect: '/new-page' }
  }
})

@manniL I'm presuming it's safe to say this can be deprecated at some point, given #120

@harlan-zw harlan-zw pinned this issue Sep 11, 2023
@manniL
Copy link
Member

manniL commented Sep 11, 2023

Yes, absolutely 馃憤

@ersah123
Copy link

This package enabled us to pull the redirect data from CMS and use it in runtime by using its middleware.
i think this is not possible with routeRules config from nuxt 3. Thats why i had to create my own local module for my use case.
Do you advise me to contribute to this repo to make it compatible with nuxt 3, or create another public module?

@manniL
Copy link
Member

manniL commented Feb 14, 2024

@ersah123 You can still use a nitro servermiddleware and pull things in there (+store them). 鈽猴笍
Not necessarily needs a module

@ersah123
Copy link

but nitro middleware is a runtime and it runs on every server request, right? So where can i pull the redirect data in build time and share with nitro middleware?

@manniL
Copy link
Member

manniL commented Feb 14, 2024

you can pull them on the first request (or during prerendering), then store them via unstorage (useStorage) and access them 馃憤

@ersah123
Copy link

But then my initial page load speed will suffer since it is like 11k lines of redirect rules i have :(
I really prefer to get them on build time

@manniL
Copy link
Member

manniL commented Feb 15, 2024

Only the first one, and as I said, you could still "warm up" that cache 鈽猴笍

@harlan-zw
Copy link
Contributor Author

But then my initial page load speed will suffer since it is like 11k lines of redirect rules i have :( I really prefer to get them on build time

You should use CloudFlare bulk redirects or something with so many

@ersah123
Copy link

But then my initial page load speed will suffer since it is like 11k lines of redirect rules i have :( I really prefer to get them on build time

You should use CloudFlare bulk redirects or something with so many

That's true. we will implement long term solution later since we are trying to do nuxt 2 - bridge - nuxt 3 migration right now.
Thanks for the suggestion :)

@ersah123
Copy link

@manniL , to update you and this topic, i have found a another solution for my use case which i believe was better as a short term solution.
Im now using nitro plugin (defineNitroPlugin) to pull data redirect data on nitro initialisation and adding that data to nitroApp's event object as new key so that it is available in every request on runtime in middleware (defineEventHandler).
There i check if the event is 404, then i run my redirect checks.

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

No branches or pull requests

3 participants