File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -466,7 +466,7 @@ export default defineConfig({
466466- ** 类型:** ` string | string[] `
467467- ** 默认:** ` VITE_ `
468468
469- 以 ` envPrefix ` 开头的环境变量会通过 import.meta.env 暴露在你的客户端源码中。
469+ 以 ` envPrefix ` 开头的环境变量会通过 ` import.meta.env ` 暴露在你的客户端源码中。
470470
471471:::warning 安全注意事项
472472` envPrefix ` 不应被设置为空字符串 ` '' ` ,这将暴露你所有的环境变量,导致敏感信息的意外泄漏。 检测到配置为 ` '' ` 时 Vite 将会抛出错误.
Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ export default {
329329}
330330` ` `
331331
332- 插件还可以定义一个 ` buildApp` 钩子。顺序 ` ' pre' ` 和 ` null ' ` 在配置的 `builder.buildApp` 之前执行,顺序 `' post' ` 钩子在其之后执行。`environment.isBuilt` 可用于检查环境是否已被构建。
332+ 插件还可以定义一个 ` buildApp` 钩子。顺序 ` ' pre' ` 和 ` ' null' ` 在配置的 ` builder .buildApp ` 之前执行,顺序 ` ' post' ` 钩子在其之后执行。` environment .isBuilt ` 可用于检查环境是否已被构建。
333333
334334## 环境无关的代码 {#environment-agnostic-code}
335335
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export default defineConfig({
115115精简工作的例子:
116116
117117- 使用 CSS 而不是 Sass/Less/Stylus(可以由 PostCSS 处理嵌套)
118- - 不要使用 ` @vitejs/plugin-react-refresh ` ,而是使用 React Fast Refresh 的原生支持 。
118+ - 不要将 SVG 转换为 UI 框架组件(例如 React、Vue 等)。请将其作为字符串或 URL 导入 。
119119- 当使用 ` @vitejs/plugin-react ` 时,避免配置 Babel 选项,这样它就会在构建期间跳过转换(只使用 esbuild)。
120120
121121使用更原生化工具链的例子:
You can’t perform that action at this time.
0 commit comments