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

Hot reloading - state of the project #850

Open
landsman opened this issue Jul 5, 2023 · 6 comments
Open

Hot reloading - state of the project #850

landsman opened this issue Jul 5, 2023 · 6 comments

Comments

@landsman
Copy link

landsman commented Jul 5, 2023

Hello, I tried to search "hot reload" via search on website, in GitHub organisation, issues etc.
What I found is a few questions about that as well.

So what is the state? Does it working, or should, is it present? From what I tried I didn't noticed.

Can you please consider to create a new page, at least under Leaf tab and describe the current situation of Hot reload feature It's fine to say that's not supported at the moment and contribution is welcome, or provide a few links to workarounds, unofficial solutions.

I believe that this is a quite common thing that every new developer looking for and there is no answer.

@ptoffy
Copy link
Member

ptoffy commented Jul 5, 2023

You can disable leaf template caching with app.leaf.cache.isEnabled = false, but yeah it makes sense for it to be in the docs

@0xTim
Copy link
Member

0xTim commented Jul 5, 2023

The cache is mentioned here but I'm happy to accept a PR to refine it. You still need to reload the page to see the changes.

There's also a PoC extension for Vapor that includes live previews of templates - https://github.com/HanneVerstraete/vapor-extension

@kublaios
Copy link

Using https://github.com/cespare/reflex, you can trigger the swift run command whenever the files under a certain directory change like so:

reflex -r 'Sources\/.*\.swift$' -R '\.build' -s swift run

Although I haven't tried it with a large project where the builds take some time.

@dector
Copy link

dector commented Sep 17, 2024

Using https://github.com/cespare/reflex, you can trigger the swift run

Sadly, that's still very ugly workaround which even making server "offline" for a sec or two on "hello world" example.

e.g. Empty project with single Leaf dependency:
Build of product 'App' complete! (1.76s)

In the roadmap (#181) "Hot Reload" is marked as done. But it's effectively absent. What is the status of this feature? Is further improvement is planned for the future or core team is happy with it as it is?

Thanks!

@0xTim
Copy link
Member

0xTim commented Sep 17, 2024

@dector the issues are probably closed more of an out of scope than fixed. It's out of scope for Vapor itself to implement and something better suited to Swift itself as proper hot loading will require compiler and runtime work

@dector
Copy link

dector commented Sep 17, 2024

the issues are probably closed more of an out of scope than fixed. It's out of scope for Vapor itself to implement and something better suited to Swift itself as proper hot loading will require compiler and runtime work

Got it, thanks. That's sad to hear as any major Web framework in another language/ecosystem offers some kind of live/hot reload. Even compiled ones. :) So I consider it as a must have for any modern web toolking with decent DX. Hope this will change some day, cause Swift looks like a nice candidate for "language for everything".

Maybe some day I'll be ready to help to implement something like this. But for now I'm just evaluating Swift ecosystem and not yet ready to invest into it. :(

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

No branches or pull requests

5 participants