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

onPrerenderStart hook not called #1702

Closed
FlorianCassayre opened this issue Jun 14, 2024 · 7 comments
Closed

onPrerenderStart hook not called #1702

FlorianCassayre opened this issue Jun 14, 2024 · 7 comments
Labels

Comments

@FlorianCassayre
Copy link
Contributor

I am in the process of migrating from plain vike + react to vike-react, in order to remove some of the boilerplate. My app supports prerendering (SSG) and i18n. For that purpose I was using the onPrerenderStart hook, which was working fine.

However it seems that after integrating vike-react this onPrerenderStart hook stopped getting called altogether on build. I have properly configured vike({ prerender: true }), and even set ssr: true (even though it is apparently the default), but to no avail.

Here is a reproducer which reuses the example boilerplate in vike-react/examples/minimal: https://github.com/FlorianCassayre/vike-react-onPrerenderStart

The latest commit contains the actual changes and demonstrates that when running npm run build the hook is not called (expected behavior would be to throw an error).

It seems on the other hand that onBeforePrerenderStart works.

@brillout brillout transferred this issue from vikejs/vike-react Jun 15, 2024
@brillout
Copy link
Member

@FlorianCassayre Indeed, something's wrong. Let me dig into this.

@brillout
Copy link
Member

Fix pre-released as 0.4.176-commit-1442a4a.

Btw. in case your company is up for it, Vike is looking for sponsors — it makes a massive difference!

@FlorianCassayre
Copy link
Contributor Author

Excellent, thanks for the quick fix. I'll patch my dependencies.

@FlorianCassayre
Copy link
Contributor Author

We're not using Vike at work (yet), however I'm happy to sponsor the project as an individual.

@brillout
Copy link
Member

Thank you, it's much appreciated 💚

@crummy
Copy link
Contributor

crummy commented Jun 17, 2024

This fixed a problem I was having (thank you!) but causes npm errors because I use vike-react which needs peer vike@">=0.4.173". How often are Vike releases?

edit: you know what, turns out we didn't really need vike-react. So I removed it; nevermind.

@FlorianCassayre
Copy link
Contributor Author

I use --force for the time being, I think I read somewhere that you could not override peer dependencies coming from monorepositories. You can also use patch-package to apply the one-liner fix.

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

No branches or pull requests

3 participants