Skip to content

Commit 149f2cf

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 ad75c78 commit 149f2cf

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)
@@ -527,6 +528,29 @@ $ ./configure --debug --enable-asan && make -j4
527528
$ make test-only
528529
```
529530

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

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

0 commit comments

Comments
 (0)