Skip to content

Commit

Permalink
cli: add flag for disabling globals
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed Nov 4, 2023
1 parent 77b0595 commit 3dfe77a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,32 @@ Affects the default output directory of:
* [`--heap-prof-dir`][]
* [`--redirect-warnings`][]

### `--disable-global=name`

<!-- YAML
added: REPLACEME
-->

> Stability: 1.2 - Release candidate
Remove specified global variables from the global scope. This flag can be used
multiple times to remove multiple variables.

Not all global variables can be removed. The currently supported variables are:

<!-- Keep alphabetized -->
- `CustomEvent`
- `fetch`; removing this also removes `FormData`, `Headers`, `Request`, and
`Response`
- `navigator`
- `WebSocket`

```bash
node --disable-global=CustomEvent --disable-global=navigator \
--eval 'console.log(typeof CustomEvent, typeof navigator)'
undefined undefined
```

### `--disable-proto=mode`

<!-- YAML
Expand Down

0 comments on commit 3dfe77a

Please sign in to comment.