Skip to content

Commit ec23749

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
[docs] Add more documentation for npm run build.
Specifically document the Linux specific limits for `inotify` which one can easily run into when combining `npm run build -- --watch` and VS code. Bug: 404192426 Change-Id: Idf301cb2e773325b2d299e61e879f85541551aa4 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6376063 Reviewed-by: Nikolay Vitkov <[email protected]> Auto-Submit: Benedikt Meurer <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]>
1 parent ebe7c75 commit ec23749

File tree

1 file changed

+63
-5
lines changed

1 file changed

+63
-5
lines changed

docs/get_the_code.md

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,75 @@ npm run build
3232

3333
The resulting build artifacts can be found in `out/Default/gen/front_end`.
3434

35-
There are two tips to have a faster development workflow:
36-
* Disabling type checking for TypeScript.
37-
* Using watch script for faster incremental builds with CSS hot reload.
35+
The build tools generally assume `Default` as the target (and `out/Default` as the
36+
build directory). You can pass `-t <name>` (or `--target=<name>`) to use a different
37+
target. For example
3838

39-
#### Disabling type checking
39+
```bash
40+
npm run build -- -t Debug
41+
```
42+
43+
will build in `out/Debug` instead of `out/Default`. If the directory doesn't exist,
44+
it'll automatically create and initialize it.
45+
46+
You can disable type checking (via TypeScript) by using the `devtools_skip_typecheck`
47+
argument in your GN configuration. This uses [esbuild](https://esbuild.github.io/)
48+
instead of `tsc` to compile the TypeScript files and generally results in much
49+
shorter build times. To switch the `Default` target to esbuild, use
50+
51+
```bash
52+
gn gen out/Default --args="devtools_skip_typecheck=true"
53+
```
54+
55+
or if you don't want to change the default target, use something like
4056

41-
You can disable type checking for TypeScript by using `devtools_skip_typecheck` argument:
4257
```bash
4358
gn gen out/fast-build --args="devtools_skip_typecheck=true"
4459
```
4560

61+
and use `npm run build -- -t fast-build` to build this target.
62+
63+
### Rebuilding automatically
64+
65+
You can use
66+
67+
```bash
68+
npm run build -- --watch
69+
```
70+
71+
to have the build script watch for changes in source files and automatically trigger
72+
rebuilds as necessary.
73+
74+
#### Linux system limits
75+
76+
The watch mode uses `inotify` by default on Linux to monitor directories for changes.
77+
It's fairly common to encounter a system limit on the number of files you can monitor.
78+
For example, Ubuntu Lucid's (64bit) inotify limit is set to 8192.
79+
80+
You can get your current inotify file watch limit by executing:
81+
82+
```bash
83+
cat /proc/sys/fs/inotify/max_user_watches
84+
```
85+
86+
When this limit is not enough to monitor all files inside a directory, the limit must
87+
be increased for the watch mode to work properly. You can set a new limit temporary with:
88+
89+
```bash
90+
sudo sysctl fs.inotify.max_user_watches=524288
91+
sudo sysctl -p
92+
```
93+
94+
If you like to make your limit permanent, use:
95+
96+
```bash
97+
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
98+
sudo sysctl -p
99+
```
100+
101+
You may also need to pay attention to the values of `max_queued_events` and `max_user_instances`
102+
if you encounter any errors.
103+
46104
### Update to latest
47105

48106
To update to latest tip of tree version:

0 commit comments

Comments
 (0)