vite-pwa / vitepress

Zero-config PWA Plugin for VitePress
https://vite-pwa-org.netlify.app/frameworks/vitepress
MIT License
36 stars 2 forks source link

Dead links cause layout crash #22

Closed sxzz closed 10 months ago

sxzz commented 10 months ago

So do Vue Macros, VueUse

userquin commented 10 months ago

@sxzz

On local works, running nr preview in pwa docs repo (VP build + preview), VP shows the not found page, 404.html, since the server is returning 404 status code.

The problem is the SPA configuration in Netlify, any request to a missing page will fallback to index.html with status code 200 (without redirection, just forwarding content). The SW will intercept the request and fallback to index.html since that page isn't in the SW precache manifest (there is an hydration missmatch error in the console).

userquin commented 10 months ago

Check response in netlify docs using /xxx in home page (first screenshot) and the same request in local (last screenshot).

imagen

imagen

userquin commented 10 months ago

and the hydration error:

imagen

userquin commented 10 months ago

upps, something wrong on my local, missing sw....

userquin commented 10 months ago

same behavior in local and Netlify, /xxx.html from sw with fallback content (/)