-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
is @vite-pwa/nuxt ssr-friendly? #58
Comments
Also happening to me. Did you find a solution @prstwo ? |
When using a meta framework we need to deal with server pages. We need the context where the PWA will run in the client, for example:
A simple workaround for Nuxt will be an empty Any api call and server page should be excluded from the sw interception: for server pages, you should add the required logic to avoid accessing those server pages if you're offline (you can also use a simple client middleware with offline logic redirecting to some page or just throw an error and handle it in a custom error page): check https://github.com/elk-zone/elk/blob/main/service-worker/sw.ts#L36-L50 (you can use |
Thanks for your response @userquin In my case I am deploying to Vercel and I have protected pages. I'm not totally sure if I understand the middleware part. It seems you want to always get the user to a default page, but we wanted them to enter the page they navigated to. So, for example: User enters /test and he gets redirected to / If we don't use PWA it works fine, but with PWA it goes to / |
Because any server page is missing from sw precache and the sw will return the content of /, if you exclude /test from sw interception (add that route to For example, if you go to https://vitesse-nuxt3.netlify.app/, enter |
In previous example, the Nuxt by default will exclude any page when using build command. In the example we exclude the hi route. |
I confirm this works. Thank you again @userquin, you are very helpful |
When I include '@vite-pwa/nuxt' in modules I get data-ssr="false". Is this related? |
Check vite-pwa/nuxt#74 |
hi, I'm using "@vite-pwa/nuxt": "^0.0.4", in my nuxt version 3 project. whenever I refresh the page, I see first the fallback page appeared and then the content of the website, here is the config:
clearing site data didn't solve my problem. the project contains multiple routes and pages. showing fallback page is not specific to one page
The text was updated successfully, but these errors were encountered: