Skip to content

Commit

Permalink
feat: Use development mode when using watch script
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ldoppea committed Jan 7, 2025
1 parent 044bc76 commit ca82d75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ca82d75

Please sign in to comment.