Giter VIP home page Giter VIP logo

Comments (7)

userquin avatar userquin commented on July 18, 2024

If using SSR app, you will need to prerender index.vue page (that's the fallback page /). Check vite-pwa/sveltekit#65 (comment) .

from nuxt.

tamanna-makkar avatar tamanna-makkar commented on July 18, 2024

@userquin
did you mean pre-render the / page ?

prerender: [
    routes: ['/']
  ]

from nuxt.

userquin avatar userquin commented on July 18, 2024

yes

from nuxt.

tamanna-makkar avatar tamanna-makkar commented on July 18, 2024

@userquin I already added the dynamic routes, so it will be pushed to prerender.routes

async 'nitro:config'(nitroConfig) {
   if (nitroConfig.dev) { return }
   const getMenuItem = useMenuNavigation()
   const response = await fetch(`${process.env.INTERNAL_API_URL}/api/globalMenuItems`)
   const { main_menu } = await response.json()
   if (nitroConfig.prerender && nitroConfig.prerender.routes) {
     nitroConfig.prerender.routes?.push(...main_menu.map((item) => getMenuItem(item).link))
   }
   console.log(nitroConfig.prerender, 'nitroConfig.prerender')
 }

still no any changes, page is working on refresh but not when I navigate to another page

from nuxt.

userquin avatar userquin commented on July 18, 2024

Create a minimal reproduction using @vite-pwa/create-pwa, I'll try to check it later...

Check https://vite-pwa-org.netlify.app/guide/scaffolding.html : select Vue and then Nuxt when selecting the framework

from nuxt.

tamanna-makkar avatar tamanna-makkar commented on July 18, 2024

okay @userquin I will make it
if I wanted it to redirect to simple offline.vue file which normally says( your are offline now ) instead of default offline page
what should I do for that ?
it would be very helpful if you can answer it
my client needs it urgently for a quick fix

Much thanks @userquin

from nuxt.

userquin avatar userquin commented on July 18, 2024

If you want to redirect to custom page (pages/offline.vue), you need to prerender the route, otherwise you will get infinite redirection when offline. In the runtime caching just redirect to that page route (/offline): you can add some logic in the callback, iirc you have the original request, or just add it to the context and use it (check callbacks params)

from nuxt.

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.