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

[VO-1227] chore: Migrate to Rsbuild #55

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

cballevre
Copy link
Contributor

### 🔧 Tech

* Migrate to Rsbuild

Related PRs:

@cballevre cballevre requested a review from zatteo as a code owner November 28, 2024 17:46
@cballevre cballevre force-pushed the feat/migrate-to-rsbuild branch from 552a4a3 to a2d7795 Compare November 29, 2024 14:11
@cballevre cballevre changed the title chore: Migrate to Rsbuild [VO-1227] chore: Migrate to Rsbuild Nov 29, 2024
@cballevre cballevre force-pushed the feat/migrate-to-rsbuild branch from a2d7795 to 98ac75f Compare November 29, 2024 15:08
@cballevre cballevre assigned cballevre and Ldoppea and unassigned cballevre Nov 29, 2024
@cballevre cballevre removed the request for review from Ldoppea November 29, 2024 15:09
Copy link

bundlemon bot commented Nov 29, 2024

BundleMon

Files added (17)
Status Path Size Limits
static/js/(chunkId).(hash).js
+616.81KB -
public/static/js/(chunkId).(hash).js
+586.7KB -
static/js/cozy.(hash).js
+413.12KB -
public/static/js/cozy.(hash).js
+380.65KB -
services/onPhotoUpload.js
+251.85KB -
services/onPhotoTrashed.js
+246.54KB -
static/js/main.(hash).js
+69.43KB -
public/static/css/cozy.(hash).css
+40.37KB -
static/css/main.(hash).css
+39.84KB -
public/static/js/lib-react.(hash).js
+39.37KB -
static/js/lib-react.(hash).js
+39.37KB -
public/static/js/public.(hash).js
+33.57KB -
static/css/cozy.(hash).css
+31.92KB -
public/static/css/public.(hash).css
+17.49KB -
static/js/lib-router.(hash).js
+16.82KB -
public/static/js/lib-router.(hash).js
+16.38KB -
assets/manifest.json
+185B -
Files removed (9)
Status Path Size Limits
vendors/photos.(hash).js
-1.23MB -
public/photos.(hash).js
-1.22MB -
services/onPhotoUpload/photos.js
-266.49KB -
services/onPhotoTrashed/photos.js
-256.88KB -
public/cozy-client-js.js
-159.28KB -
app/photos.(hash).js
-57.12KB -
public/photos.(hash).min.css
-46.47KB -
app-photos.(hash).min.css
-19.75KB -
manifest.json
-185B -
Files updated (2)
Status Path Size Limits
index.html
575B (+61B +11.87%) -
manifest.webapp
1.14KB (+20B +1.74%) -

Total files change -470.53KB -14.2%

Groups added (3)
Status Path Size Limits
**/*.js
+2.65MB -
**/*.css
+129.62KB -
**/*.{png,svg,ico}
+41.3KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@zatteo
Copy link
Contributor

zatteo commented Dec 3, 2024

@cballevre very nice work


let middlewares = [thunkMiddleware, loggerMiddleware]

// Enable Redux dev tools
const composeEnhancers =
(__DEVELOPMENT__ && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose
(flag('debug') && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the flag plugin is initialized on client's login event and because client.login() is asynchronous, it seems like relying on flag('debug') here would be subject to race condition, wouldn't it?

I suppose it would work here because on web apps, the client.login() only access local resources, so it would be fast enough to ends before the composeEnhancers initialisation. But it seems a bit risky.

@Ldoppea
Copy link
Member

Ldoppea commented Dec 10, 2024

This commit message says the opposite of what is done. Is the error on the message? or on what have been done?
image

@cballevre
Copy link
Contributor Author

This a mistake on the message 🙁

@Ldoppea Ldoppea force-pushed the feat/migrate-to-rsbuild branch from 98ac75f to ca82d75 Compare January 7, 2025 09:20
In cozy-script we used to enforce the development mode when doing a
`yarn watch`

The development mode changes the build behavior by removing some steps
like minification which results to a faster build

A side effect is that the code generated from the `watch` command is a
bit different than the one generated from `build` command. This may
produce some differences on the app's behavior, but this is rare enough
(happened 1 or 2 times in the past years) so we consider the speed gain
to still be valuable. Also we know that we should run a `build` locally
as ultimate check before pushing new code to the git repo

So we want to enable this mode in the new Rsbuild configuration

Here are the timings for initial build and then 4 differents edits in
the code that trigger a re-build

yarn watch
```
    7,57s (initial build)
    5,79s
    5,83s
    6,68s
    7,15s
```

yarn watch --mode development
```
    7,00s (initial build)
    0,69s
    0,45s
    0,92s
    0,46s
```

Related code:
https://github.com/cozy/create-cozy-app/blob/master/packages/cozy-scripts/scripts/watch.js#L13
@Ldoppea Ldoppea force-pushed the feat/migrate-to-rsbuild branch from ca82d75 to 588ab49 Compare January 7, 2025 09:41
@Ldoppea Ldoppea force-pushed the feat/migrate-to-rsbuild branch from 44e02d4 to 8f998c6 Compare January 7, 2025 11:29
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

Successfully merging this pull request may close these issues.

3 participants