-
Notifications
You must be signed in to change notification settings - Fork 64
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-1282] chore: Migrate to Rsbuild #3296
base: master
Are you sure you want to change the base?
Conversation
BundleMonFiles added (19)
Files removed (16)
Files updated (1)
Unchanged files (1)
Total files change -596.49KB -10.09% Groups added (3)
Groups removed (7)
Final result: ✅ View report in BundleMon website ➡️ |
98c82cd
to
7201534
Compare
This commit title seems incomplete |
Great job! 🎉 Can't wait to build faster than light ✨ |
cb626f2
to
2f7e44e
Compare
6975fba
to
67e92a4
Compare
In #3182 we reworked Breadcrumbs to display the root folder and Shared drives' root as an icon instead of text Unit tests did not reflect this changes but did continue to pass due to a bug in cozy-client-js exports making the ROOT_DIR_ID undefined Since we removed cozy-client-js and used a defined constant instead then unit tests would fail This commit fixes all the tests to reflect the new "icon" behavior
With the Rsbuild migration, the transpiled code now use `let` and `const` features contrary to the previous Webpack configuration that converted them to `var` This highlight some bug that we previously missed where some variables were used before being declared. This did not produce any throw when using `var` due to hoisting, but this may produce bug as the accessed variable may be undefined
With the Rsbuild migration, the transpiled code now use `let` and `const` features contrary to the previous Webpack configuration that converted them to `var` This highlight some bug that we previously missed where some variables were used before being declared. This did not produce any throw when using `var` due to hoisting, but this may produce bug as the accessed variable may be undefined Warning: This would fix the `fil-content-row-selected` class attribution, however this class is not compatible yet with dark theme, so we want to enforce `undefined` until we fix the theme. Until then the behaviour will be like before when the `selected` variable was always `undefined`
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 ``` 11,70s (initial build) 9,87s 9,89s 10,10s 10,80s ``` yarn watch --mode development ``` 6,64s (initial build) 1,42s 0,73s 0,72s 0,77s ``` Related code: https://github.com/cozy/create-cozy-app/blob/master/packages/cozy-scripts/scripts/watch.js#L13
`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
Since previous commit we can run `rsbuild dev` to enable HMR feature We now have 3 different scripts: - `yarn build`: build the app for production - `yarn watch`: like for the `build` script but with some optimizations in order to build faster and to trigger rebuild automatically when the code changes - `yarn dev`: build the app with HMR enabled. This should be the fastest way to debug the app, but the HMR feature may prevent the app to work in some environments (i.e. flagship app)
`cozy-dataproxy-lib` has been upgraded to `2.3.1` in order to retrieve a fix on package.json configuration that did not export the dataproxy's `stylesheet.css` Related PR: cozy/cozy-libs#2699
By migrating from webpack to rsbuild we lost this resolution override that is needed by react-pdf for generating PDFs previews using WebWorkers More details: https://github.com/cozy/cozy-libs/blob/a00baa1723bd7d37591fe95dcc1921d4e2c24f87/packages/cozy-viewer/src/Readme.md?plain=1#L299-L335
In previous commit we removed cozy-client-js so we now want Intents to work with cozy-client instead
This intent seems to be unused anymore as no call can be found in our entire code base
Since the react-pdf's webpack resolver is declared in `rsbuild.config.mjs` then we don't need to manually enforce a worker in PublicViewer A worker will be used anyway thanks to the webpack resolver
`rsbuild-config-cozy-app` has been upgraded to `0.2.1` in order to retrieve the configuration needed to run intents and public targets in the `rsbuild dev` mode Related PR: cozy/cozy-libs#2717
67e92a4
to
5aeb3c3
Compare
package.json
Outdated
"watch": "cozy-scripts watch --barV7 false --cozyClientJs", | ||
"start": "cozy-scripts start --barV7 false --cozyClientJs", | ||
"build": "rsbuild build", | ||
"watch": "rsbuild build --watch", |
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.
on pourrait garder le start ici non ?
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.
pourquoi avoir déplacé les assets statiques dans /public ? Y'a t-il une raison en lien avec rsbuild ?
@@ -24,19 +24,11 @@ | |||
name="viewport" | |||
content="width=device-width, height=device-height, initial-scale=1, viewport-fit=cover" | |||
/> | |||
<% if (__STACK_ASSETS__) { %> |
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.
le __STACK_ASSETS__
c'est pas les overrides ? Est-ce qu'on ne perd pas cette feature au passage ?
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.
à quoi ça sert si les alias "directs" (genre modules, components etc.) existent 🤔 Ne faudrait-il pas les supprimer au passage ? Garder les deux approches me semble inutile non ?
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.
on avait pas déplacé les assets dans /public justement ? 🤔
const filContentRowSelected = cx(styles['fil-content-row'], { | ||
[styles['fil-content-row-selected']]: selected, | ||
[styles['fil-content-row-selected']]: undefined, // TODO: replace with `selected` and fix dark theme for this variable |
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.
est-ce que le TODO est traité plus tard ?
@@ -9,7 +9,6 @@ | |||
"cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --prepublish downcloud --postpublish mattermost", | |||
"tx": "tx pull --all || true", | |||
"lint": "npm-run-all --parallel 'lint:*'", | |||
"lint:styles": "stylint src --config ./node_modules/cozy-scripts/config/.stylintrc", |
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.
est-ce qu'on le remet plus tard ?
@@ -5,6 +5,7 @@ | |||
"scripts": { | |||
"build": "rsbuild build", | |||
"watch": "rsbuild build --watch --mode development", | |||
"start": "rsbuild dev", |
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.
nit: le commentaire du commit n'est pas raccord avec le code (yarn dev d'un côté, yarn start de l'autre)
@@ -92,6 +92,7 @@ | |||
"cozy-flags": "^4.6.1", | |||
"cozy-harvest-lib": "^32.2.6", | |||
"cozy-intent": "^2.29.1", | |||
"cozy-interapp": "^0.15.1", |
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.
pourquoi donc ? C'était une coquille sur Drive ou c'est en lien avec la migration ?
This PR migrate the project's bundler from Webpack to Rsbuild
Non-regression tests have been done:
OPEN
intentyarn service build/services/<serviceFileName>
Warning
I identified a bug in the
File.jsx
code where we apply thefil-content-row-selected
class on selected filesPreviously the variable was always
undefined
. If I fix this line, I introduce a visual bug on Dark theme, so I chose enforce theundefined
until we fix the theme on another PRSee the
// TODO
comment in theFile.jsx
filePerformances comparison on my computer:
yarn build
yarn watch
Related PRs: