Skip to content

Commit e37a51d

Browse files
authored
docs: note api run in same process (#8230)
1 parent e68c25c commit e37a51d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/guide/api-javascript.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ const { createServer } = require('vite')
3030
})()
3131
```
3232

33+
::: tip NOTE
34+
When using `createServer` and `build` in the same Node.js process, both functions rely on `process.env.`<wbr>`NODE_ENV` to work properly, which also depends on the `mode` config option. To prevent conflicting behavior, set `process.env.`<wbr>`NODE_ENV` or the `mode` of the two APIs to `development`. Otherwise, you can spawn a child process to run the APIs separately.
35+
:::
36+
3337
## `InlineConfig`
3438

3539
The `InlineConfig` interface extends `UserConfig` with additional properties:

docs/guide/ssr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Our scripts in `package.json` will look like this:
169169
170170
Note the `--ssr` flag which indicates this is an SSR build. It should also specify the SSR entry.
171171
172-
Then, in `server.js` we need to add some production specific logic by checking `process.env.NODE_ENV`:
172+
Then, in `server.js` we need to add some production specific logic by checking `process.env.`<wbr>`NODE_ENV`:
173173
174174
- Instead of reading the root `index.html`, use the `dist/client/index.html` as the template instead, since it contains the correct asset links to the client build.
175175

0 commit comments

Comments
 (0)