Skip to content

Commit

Permalink
Update define-constant.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Apr 23, 2024
1 parent dd774c7 commit 90fc629
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/guides/runtime/define-constant.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ To make all usages of `window` be `undefined`, you can use the following command
bun --define window="undefined" src/index.ts
```

---

This can be useful when Server-Side Rendering (SSR) or when you want to make sure that the code doesn't depend on the `window` object.

```js
Expand All @@ -91,8 +93,6 @@ bun --define global="globalThis" src/index.ts

`global` is a global object in Node.js, but not in web browsers. So, you can use this to fix some cases where the code assumes that `global` is available.

---

### Replace values with JSON

`--define` can also be used to replace values with JSON objects and arrays.
Expand Down

0 comments on commit 90fc629

Please sign in to comment.