From ca82d75ed4ff930ab4e7dbe621c9e2cd000f277c Mon Sep 17 00:00:00 2001 From: Ldoppea Date: Tue, 7 Jan 2025 10:15:44 +0100 Subject: [PATCH] feat: Use `development` mode when using `watch` script 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 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 317eeaf7..eb7d526c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "src/main.jsx", "scripts": { "build": "rsbuild build", - "watch": "rsbuild build --watch", + "watch": "rsbuild build --watch --mode development", "analyze": "RSDOCTOR=true yarn build", "cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --build-dir 'build/' --prepublish downcloud --postpublish mattermost", "tx": "tx pull --all || true",