-
Notifications
You must be signed in to change notification settings - Fork 991
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
Introduce RSC "live reload." #10932
Introduce RSC "live reload." #10932
Conversation
@@ -48,6 +48,7 @@ | |||
}, | |||
"bin": { | |||
"rw-dev-fe": "./dist/devFeServer.js", | |||
"rw-dev-rsc": "./dist/devRscServer.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a command that will be executed by the Redwood CLI.
'access-control-allow-origin': '*', | ||
}) | ||
}) | ||
.listen(8913) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if hard coding this port is the correct approach, but could be OK for right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good enough for now! 🙂
This PR introduces a development server with "live reload" functionality to the RSC parts of Redwood. Live reload enables developers to see changes immediately after saving a file, without needing to perform any additional actions.
The primary goal of this PR is to enhance the development experience. While live reload is a basic implementation of the "do something, see something" paradigm, it offers significant improvements to developer efficiency with minimal effort.
Here's a loom: https://www.loom.com/share/51463c3f6f1b40c5b8ee79d599f673d7?from_recorder=1&focus_title=1
How does it work?
We use
chokidar
to monitor the user's workspace for file changes. When a file change is detected, the following steps are executed:This process allows developers to see the impact of their changes immediately without needing to manually rebuild and restart the web server.
Next steps: I plan to focus on speed improvements and then implement Hot Module Replacement (HMR).
Test it yourself: