mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Update define-constant.md
This commit is contained in:
@@ -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
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user