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

Remove dist/server/ upon $ vike build + pre-rendering #1851

Open
brillout opened this issue Sep 5, 2024 · 7 comments
Open

Remove dist/server/ upon $ vike build + pre-rendering #1851

brillout opened this issue Sep 5, 2024 · 7 comments
Labels
enhancement ✨ New feature or request

Comments

@brillout
Copy link
Member

brillout commented Sep 5, 2024

Description

dist/server/ isn't needed for a fully pre-rendered app, and users are often confused about why it's there. We can remove it once we implement Vike's CLI.

It should only be removed if the user doesn't disable build chaining.

Blocker: Vike's CLI.

@brillout brillout added the enhancement ✨ New feature or request label Sep 5, 2024
@JayaKrishnaNamburu
Copy link

If prerender is enabled. Should vike also remove dist/assets/entires/entry-server-routing.js or dist/assets/entries/entry-client-routing.js files too. Which are injected in the buildConfig stage here

} else {
let { hasClientRouting, hasServerRouting, clientEntries } = analyzeClientEntries(pageConfigs, config)
if (Object.entries(pageFileEntries).length > 0) {
hasClientRouting = true
hasServerRouting = true
}
const entries: Record<string, string> = {
...clientEntries,
...pageFileEntries
}
const clientRoutingEntry = resolve(`dist/esm/client/client-routing-runtime/entry.js`)
const serverRoutingEntry = resolve(`dist/esm/client/server-routing-runtime/entry.js`)
if (hasClientRouting) {
entries['entries/entry-client-routing'] = clientRoutingEntry
}
if (hasServerRouting) {
entries['entries/entry-server-routing'] = serverRoutingEntry
}
return entries

Or they still needed in terms of serverRouting / clientRouting aspect. And can you help me understand what's the main difference between the both. Because both seem to run inside the browser and wondering what's the difference and if they are really needed.

@brillout
Copy link
Member Author

brillout commented Jan 7, 2025

See https://vike.dev/clientRouting. Indeed, of the two entries can be removed (but not always since clientRouting can differ on page-by-page basis).

@JayaKrishnaNamburu
Copy link

But the entry-server-routing.js file can be removed ?
If the prender is set to true and the clientRouting is set to false ?

The JS check seems to inject the server routing file, which is expected as the default behaviour as client routing is disabled. But isn't it redundant to have prerendered and server-routing both ?

@JayaKrishnaNamburu
Copy link

@brillout checking again, if the pre-rendering is enabled
https://vike.dev/pre-rendering#how-to-pre-render

is it safe to remove dist/assets/entries/entry-server-routing.js and dist/assets/entry-client-routing.js files ?

@brillout
Copy link
Member Author

brillout commented Jan 8, 2025

Actually, why do you want to remove them in the first place? What's the issue you're trying to solve?

@JayaKrishnaNamburu
Copy link

JayaKrishnaNamburu commented Jan 9, 2025

It's actually trying to work with netlify forms. So, ideally pre-rendering should allow them to be detectable. But, the whole netlify form detection behaviour is bit of a black box. So, if we remove routing` files the detection is working. But it the routing files exists, i think its rendering them as client side ones and not able to detect. Might be a bug on the netlify detection side itself, but checking we can remove routing files.

@brillout
Copy link
Member Author

brillout commented Jan 9, 2025

@JayaKrishnaNamburu Can you create a new GitHub discussion and elaborate more? It's unrelated to this issue. I'll reply over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants