frandiox / vite-ssr

Use Vite for server side rendering in Node
MIT License
824 stars 91 forks source link

Dev server mode: styles applying delay #107

Closed plashenkov closed 2 years ago

plashenkov commented 2 years ago

Hi!

There is a visual problem when using vite-ssr in dev server mode: the styles applying delay.

When you load/reload a page, you see it without styling first. And after a moment you can see how styles apply.

When using vanilla vite in dev server mode, or when serving built application (with SSR) in production mode, there is no such issue.

Is there any way to workaround this?

frandiox commented 2 years ago

@plashenkov Hi! This is an issue in Vite itself when using SSR: https://github.com/vitejs/vite/issues/2282

There are some workarounds mentioned in that issue that you could try I guess. For vite-ssr itself, since it only happens in development I'm rather hoping that the issue is fixed upstream instead of implementing a workaround here. Although I would be open to PRs of course.

plashenkov commented 2 years ago

@frandiox Ah, I see, thank you.

since it only happens in development I'm rather hoping that the issue is fixed upstream instead of implementing a workaround here

Yes, that totally makes sense. Let's close this for now and hope this will be fixed in Vite.