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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vike preview seemingly serves dist/server - unclear from docs, leads to missed issues with pre-rendering config #2232

Open
mz8i opened this issue Feb 27, 2025 · 1 comment

Comments

@mz8i
Copy link

mz8i commented Feb 27, 2025

Description

My understanding is that running vike preview always runs a local server based on dist/server, rather than simply serving the static files in dist/client - even for fully pre-rendered sites.

I ran into this as I was using vike preview to verify that the production build of a simple app I'm building works well. The app is hosted on GitHub Pages and so is fully pre-rendered.

But I had a bug in +onBeforePrerenderStart.ts for a certain route, where some of the values of a path parameter were not listed correctly. Testing with vike preview, this did not come up as an issue because the server bundle didn't rely on +onBeforePrerenderStart.ts at all. I only realised the problem after deploying the public site and getting a 404 for some URLs.

Perhaps the current behavior is the most sensible default - however, I think it should be stated more clearly in the docs and the startup output of the CLI command that this is exactly what's happening.

@brillout
Copy link
Member

I agree, $ vike preview shouldn't use SSR when the page is pre-rendered. (It's actually a regression we had to introduce because of a Vite change, but let me have another look at it — I may have an idea.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants