diff --git a/docs/guide/api-javascript.md b/docs/guide/api-javascript.md index 0128be26bd92ba..cf1f7d97c6bc71 100644 --- a/docs/guide/api-javascript.md +++ b/docs/guide/api-javascript.md @@ -30,6 +30,10 @@ const { createServer } = require('vite') })() ``` +::: tip NOTE +When using `createServer` and `build` in the same Node.js process, both functions rely on `process.env.``NODE_ENV` to work properly, which also depends on the `mode` config option. To prevent conflicting behavior, set `process.env.``NODE_ENV` or the `mode` of the two APIs to `development`. Otherwise, you can spawn a child process to run the APIs separately. +::: + ## `InlineConfig` The `InlineConfig` interface extends `UserConfig` with additional properties: diff --git a/docs/guide/ssr.md b/docs/guide/ssr.md index 319b461022433d..ee078e82eb60a1 100644 --- a/docs/guide/ssr.md +++ b/docs/guide/ssr.md @@ -169,7 +169,7 @@ Our scripts in `package.json` will look like this: Note the `--ssr` flag which indicates this is an SSR build. It should also specify the SSR entry. -Then, in `server.js` we need to add some production specific logic by checking `process.env.NODE_ENV`: +Then, in `server.js` we need to add some production specific logic by checking `process.env.``NODE_ENV`: - 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.