You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's important to note that `NODE_ENV` (`process.env.NODE_ENV`) and modes are two different concepts. Here's how different commands affect the `NODE_ENV`and mode:
@@ -178,9 +178,9 @@ The different values of `NODE_ENV` and mode also reflect on its corresponding `i
178
178
| `--mode development` | `"development"` |
179
179
| `--mode staging` | `"staging"` |
180
180
181
-
:::tip `NODE_ENV` in `.env` files
181
+
:::tip `.env` 文件中的 `NODE_ENV`
182
182
183
-
`NODE_ENV=...`can be set in the command, and also in your `.env`file. If `NODE_ENV` is specified in a `.env.[mode]`file, the mode can be used to control its value. However, both `NODE_ENV` and modes remain as two different concepts.
The main benefit with `NODE_ENV=...`in the command is that it allows Vite to detect the value early. It also allows you to read `process.env.NODE_ENV` in your Vite config as Vite can only load the env files once the config is evaluated.
185
+
命令中使用 `NODE_ENV=...`的主要好处是,它允许 Vite 提前检测到该值。这也使你能够在 Vite 配置中读取 `process.env.NODE_ENV`,因为 Vite 只有在解析配置之后才能加载环境变量文件。
0 commit comments