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

feat: devlopment mode #24

Open
hulxv opened this issue Sep 22, 2024 · 2 comments
Open

feat: devlopment mode #24

hulxv opened this issue Sep 22, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@hulxv
Copy link
Collaborator

hulxv commented Sep 22, 2024

Description

To simplify the development process, we need to dev mode watching the source code of the web application and rebuilding it on every change with hot-reloading.

@hulxv hulxv added the enhancement New feature or request label Sep 22, 2024
@fahdfady
Copy link

I'd be happy to help making this work.
this is how I would approach this problem:

Overview

We need development mode in metassr like nextjs. this is already implemented in various frameworks.
i think it should be something like this

flowchart TD
	A[File change] --> B[Rebuild]
	B --> C[Notify client]
	C --> A
Loading

Technical overview

1. create a new crate metassr-watcher

this will be a file-watcher written in Rust, that watches for any changes withing our web app file system.
for this, we can look into Notify Crate for rust
and rspack hmr for javascript

2. Build Pipeline

modify the pipeline to: handle rebuilding the modified files, then update the dist directory.

3. Hot Reloading (fast refresh)

We'll create a new module in metassr-server for handling hot reloading:
having a websocket connection with the client (web browser) then update the browser based on dist changes.
This part is a bit tricky because we'd obviously not love to be refreshing the entire page each build! React has something that's called Fast Refresh we should look into

@hulxv
Copy link
Collaborator Author

hulxv commented Feb 17, 2025

Very cool explanation man!
It's the same idea I had but with more details. I will assign it to you and we can work together.

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants