Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/shared-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export default defineConfig({
- **类型:** `string | string[]`
- **默认:** `VITE_`

以 `envPrefix` 开头的环境变量会通过 import.meta.env 暴露在你的客户端源码中。
以 `envPrefix` 开头的环境变量会通过 `import.meta.env` 暴露在你的客户端源码中。

:::warning 安全注意事项
`envPrefix` 不应被设置为空字符串 `''`,这将暴露你所有的环境变量,导致敏感信息的意外泄漏。 检测到配置为 `''` 时 Vite 将会抛出错误.
Expand Down
2 changes: 1 addition & 1 deletion guide/api-environment-frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export default {
}
```

插件还可以定义一个 `buildApp` 钩子。顺序 `'pre'` 和 `null'` 在配置的 `builder.buildApp` 之前执行,顺序 `'post'` 钩子在其之后执行。`environment.isBuilt` 可用于检查环境是否已被构建。
插件还可以定义一个 `buildApp` 钩子。顺序 `'pre'` 和 `'null'` 在配置的 `builder.buildApp` 之前执行,顺序 `'post'` 钩子在其之后执行。`environment.isBuilt` 可用于检查环境是否已被构建。

## 环境无关的代码 {#environment-agnostic-code}

Expand Down
2 changes: 1 addition & 1 deletion guide/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default defineConfig({
精简工作的例子:

- 使用 CSS 而不是 Sass/Less/Stylus(可以由 PostCSS 处理嵌套)
- 不要使用 `@vitejs/plugin-react-refresh`,而是使用 React Fast Refresh 的原生支持
- 不要将 SVG 转换为 UI 框架组件(例如 React、Vue 等)。请将其作为字符串或 URL 导入
- 当使用 `@vitejs/plugin-react` 时,避免配置 Babel 选项,这样它就会在构建期间跳过转换(只使用 esbuild)。

使用更原生化工具链的例子:
Expand Down