-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Enable HMR on shared Rsbuild configuration #2700
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In our projects, we found that using `rsbuild build --watch --mode development` instead of just `rsbuild build --watch` would speed up the re-build process But when doing so, the bundler enables the [fastRefresh](https://rsbuild.dev/plugins/list/plugin-react#fastrefresh) mode from plugin-react This mode does not work on `build` mode and trying to run the cozy-apps would produce a blank screen with some `$RefreshSig$ is not defined` This is because fastRefresh is meant to be run with `rsbuild dev` command So we want to disable this mode for all commands but `rsbuild dev`
zatteo
approved these changes
Jan 15, 2025
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.
🎉
By default Hot Module Rreplacement is configured to work with a localhost dev server This server is responsible to serve the app and enable HMR This wouldn't work with our apps because they are meant to be served by a local cozy-stack as a dev environment and so the cozy-app would try to connect to the HMR websocket using the cozy-stack's URL Also the Rsbuild dev server is configured to serve built files from memory, so the `/build` folder would be empty and the cozy-stack wouldn't see any app To fix this we can use both `dev.writeToDisk` and `dev.client` configurations Then in order to benefit from this, the cozy-app should be run using `rsbuild dev` instead of `rsbuild build --watch` More info: - web-infra-dev/rsbuild#4366 - https://rsbuild.dev/config/dev/write-to-disk#writing-to-disk - https://rsbuild.dev/config/dev/client
f06f8a7
to
3b5b0e2
Compare
Ldoppea
added a commit
to cozy/cozy-settings
that referenced
this pull request
Jan 15, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-photos
that referenced
this pull request
Jan 15, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 15, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 15, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 15, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 15, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 15, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
zatteo
pushed a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 27, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
zatteo
pushed a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 27, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 28, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 28, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 28, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 29, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Jan 30, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Ldoppea
added a commit
to cozy/cozy-drive
that referenced
this pull request
Feb 6, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
zatteo
pushed a commit
to cozy/cozy-drive
that referenced
this pull request
Feb 7, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
zatteo
pushed a commit
to cozy/cozy-drive
that referenced
this pull request
Feb 11, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
zatteo
pushed a commit
to cozy/cozy-photos
that referenced
this pull request
Mar 11, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
zatteo
pushed a commit
to cozy/cozy-settings
that referenced
this pull request
Mar 18, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
JF-Cozy
pushed a commit
to cozy/cozy-settings
that referenced
this pull request
Mar 18, 2025
`rsbuild-config-cozy-app` has been upgraded to `0.2.0` in order to retrieve the configuration needed to run `rsbuild dev` with our cozy-stack based architecture and then benefits from HMR feature Related PR: cozy/cozy-libs#2700
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default Hot Module Rreplacement is configured to work with a localhost dev server
This server is responsible to serve the app and enable HMR
This wouldn't work with our apps because they are meant to be served by a local cozy-stack as a dev environment and so the cozy-app would try to connect to the HMR websocket using the cozy-stack's URL
Also the Rsbuild dev server is configured to serve built files from memory, so the
/build
folder would be empty and the cozy-stack wouldn't see any appTo fix this we can use both
dev.writeToDisk
anddev.client
configurationsThen in order to benefit from this, the cozy-app should be run using
rsbuild dev
instead ofrsbuild build --watch
More info: