-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
vite-ssg (yargs) does not terminate if setInterval is used #113
Comments
You should not use timers in SSR/SSG (use We could have a timeout mechanism like Nuxt to exist the process when the bundler finished but process handing for certain minutes. PR welcome. |
I can provide such a PR. :-) But do you really want to wait some minutes? Personally I prefer a shorter time, like 10 seconds or maybe up to 30 seconds. At the moment I can't think about a case where it would be better to wait longer. |
Sure. like 15 seconds sounds reasonable - or we can adjust it based on feedback anyway. Looking forward to your PR! |
I have a project that has a page included with a counter component (counting each second down until an event starts) that uses setInterval. Yargs seems to wait for the interval to end, which does not happen.
I think there could be similiar situations in websites where some components provide code that does not finish.
In my project I have a ci pipleine that waits for vite-ssg to finish in order to do the next build steps.
A quick fix for me was to add process.exit(0) to the onFinished option:
I am just wondering if this should be the default behaviour, to call
process.exit(0)
after the build has finished. It took me quite some time to find the reason why vite-ssg did not terminate the process.If this should not be the default behaviour, maybe we can provide a warning?
The text was updated successfully, but these errors were encountered: