Skip to content

Commit 8b34918

Browse files
mmomtchevtargos
authored andcommitted
doc: add two tips for speeding the dev builds
Add two important tips for novice Node.js contributors PR-URL: #36452 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 6198d74 commit 8b34918

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

BUILDING.md

+24
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ file a new issue.
3030
* [Building the documentation](#building-the-documentation)
3131
* [Building a debug build](#building-a-debug-build)
3232
* [Building an ASAN build](#building-an-asan-build)
33+
* [Speeding up frequent rebuilds when developing](#speeding-up-frequent-rebuilds-when-developing)
3334
* [Troubleshooting Unix and macOS builds](#troubleshooting-unix-and-macos-builds)
3435
* [Windows](#windows)
3536
* [Prerequisites](#prerequisites)
@@ -526,6 +527,29 @@ $ ./configure --debug --enable-asan && make -j4
526527
$ make test-only
527528
```
528529

530+
#### Speeding up frequent rebuilds when developing
531+
532+
If you plan to frequently rebuild Node.js, especially if using several branches,
533+
installing `ccache` can help to greatly reduce build times. Set up with:
534+
```console
535+
$ sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros
536+
$ ccache -o cache_dir=<tmp_dir>
537+
$ ccache -o max_size=5.0G
538+
$ export CC="ccache gcc" # add to your .profile
539+
$ export CXX="ccache g++" # add to your .profile
540+
```
541+
This will allow for near-instantaneous rebuilds even when switching branches.
542+
543+
When modifying only the JS layer in `lib`, it is possible to externally load it
544+
without modifying the executable:
545+
```console
546+
$ ./configure --node-builtin-modules-path $(pwd)
547+
```
548+
The resulting binary won't include any JS files and will try to load them from
549+
the specified directory. The JS debugger of Visual Studio Code supports this
550+
configuration since the November 2020 version and allows for setting
551+
breakpoints.
552+
529553
#### Troubleshooting Unix and macOS builds
530554

531555
Stale builds can sometimes result in `file not found` errors while building.

0 commit comments

Comments
 (0)