-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Pre-render, preact-router and Single Page Application #465
Comments
You generally don't have to tell the server what to use, just give it a directory and redirect 404 to |
But if I do that, the pre-rendering is useless because the generated files are never served :/ Edit pre-rendering = All the route pre-rendered thanks to |
They are Give the server a directory to serve, then it should automatically find the right files to serve |
Ok I see your point but let's say I have this route: So what do you suggest to do in that case? |
redirect to |
But i don't want to redirect to |
Yeah, but setting up custom routes is harder than to just let the client handle it Redirect was the wrong word, just serve index.html, but keep the path so the client can do it |
You can pre-render whatever & however many routes you want. Is it always a good idea? Depends, but no not always. Will the content always be replaced during client rehydration? Yes. For your case, I would either pick up a server & take an approach similar to |
That's super interesting, thanks for all your insights, after more research, i can see a little bit more clearly the use case of each solutions. Let's do a recap:
I guess I can stick with pre-rendering with a good proxy rules for almost all the projects I'm working on :) I'll close the ticket, don't hesitate to reopen it if you want to go further :) Cheers |
Hi guys, i'd like to ask a question about the purpose of pre-rendering in a SPA.
To make the SPA working, we need to run a server that redirect all the requests to a
index.html
right?So usually we redirect requests to the root
index.html
file, but then prerendering becomes useless.So if we prerender all the pages of our app, we would need to configure our server and specify what
route/index.html
to use for each requests. But then if we have some param url, we need to specify it as well so the server knows which index.html to serve.This seems a little overcomplicated isn't it? It seems that SSR is an easier solution afterall..
What do you think? Am I missing something? Can it be more simple? Or maybe the only purpose of the prerendering is to build a static website?
The text was updated successfully, but these errors were encountered: