-
Notifications
You must be signed in to change notification settings - Fork 88
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
The serve command returns exit code 0 when compilation fails #230
Comments
As I understand serve, it's not supposed to do any kind of building, it's only supposed to try and run the existing binary and other files.
Now that we have very experimental static site support, it would make sense to be able to generate those files, but I don't think anyone has thought much about that usecase for cargo-leptos.
I'd imagine you'd want a different command, or it to be part of build. Are you saying that your project compiles successfully, and then fails to create the static assets at runtime?
…On Sat, Dec 30, 2023, at 2:54 AM, Niklas Eicker wrote:
I use the `serve` command to build a static site. It returns when all routes are "rendered". If compilation fails, `cargo leptos serve` returns `0`, which causes issues in my CD pipeline.
Is there any reason for the command not to fail in this case?
—
Reply to this email directly, view it on GitHub <#230>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABVBTCMY2W5DXCBM4CGPOETYL7XHZAVCNFSM6AAAAABBHODDI6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DANZRGIZDQNQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
The serve command actually does exactly what I need for static site generation. The name might not really fit, but the functionality is correct. It compiles the bin for the native target and the frontend for WASM. Then it runs the binary. For a SSR app the binary will start the actix/axum server. In the case of SSG, it will generate the html files of static routes. This issue is really only about the return code of the command. Even if you use |
I should say that serve building the package is at best an oversight and at worst a bug, as serve really is only supposed to serve an existing binary. Is it possible to solve your use case by running build first to catch compilation errors, and then serve? Or is there another level of runtime errors you're hoping to catch around generation? |
I expect serve to also build. Other tools do the same. Running build before serve could be a work-around, yes. |
I use the
serve
command to build a static site. It returns when all routes are "rendered". If compilation fails,cargo leptos serve
returns0
, which causes issues in my CD pipeline.Is there any reason for the command not to fail in this case?
The text was updated successfully, but these errors were encountered: