Skip to content

Commit

Permalink
fix: Disable fastRefresh in shared Rsbuild configuration
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
Ldoppea committed Jan 15, 2025
1 parent 56e9eed commit e51382e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/rsbuild-config-cozy-app/getRsbuildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function getRsbuildConfig({
plugins: [
pluginEjs(),
pluginNodePolyfill(),
pluginReact(),
pluginReact({
fastRefresh: import.meta.env.NODE_ENV === 'development'
}),
pluginStylus({
stylusOptions: {
// To resolve import from cozy-ui inside stylus files
Expand Down

0 comments on commit e51382e

Please sign in to comment.