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

Why watching for files manually when we can just start the deno server with --watch? #2

Closed
lordanubi opened this issue May 23, 2022 · 2 comments

Comments

@lordanubi
Copy link

Maybe they added this feature later I don't know but it should be better since it's native (i guess). Can't this plugin just send an event to the browser when the server starts instead of watching files and dealing with refreshing the server as well
What do you think about it?

@cmorten
Copy link
Owner

cmorten commented May 23, 2022

That would also be viable, just subtleties to the approach!

If you rely on the --watch flag (REF: https://deno.land/manual/getting_started/command_line_interface#watch-mode) then you will be completely restarting your server, it's a fancy way of killing the program and starting it again. It means you will have to rerun any bootstrapping, wait for the server to be live again etc.

In simple scenarios there isn't much between this and the file watcher built into this module, but if imagine your startup is costly / slow then it may not be as practical for fast development (e.g. say have to do some handshake with a DB and other whatnot).

Now if you are wanting to work on the server code itself, then really restarting the server is more desireable - but the use-case I wrote this module for was simple reload of the browser while working on front-end code 🙂

Alternative dev-tooling is always awesome, so be cool to see your idea as a Deno module some day 🎉

@lordanubi
Copy link
Author

I have the same purpose actually, I'm working on my jsx front-end code (which is ssr rendered) but for some strange reason when editing a component props, removing it from the dom etc... the updates won't have any effect even after manually reloading the page.
With the --watch flag though the rendered html is updated and so the browser shows me the new updated components.
Maybe we have something set up differently I'm not sure.
Anyway I have a simple project for now so I'll just stick with the --watch flag (I also added the --no-check flag to make the server restart way faster!)
Thanks for your great module anyway! Really useful!

@cmorten cmorten closed this as completed Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants