From be19df99315bb4c1754bc48a7196a44b83e5ef4c Mon Sep 17 00:00:00 2001 From: "@beer" <47961062+iiio2@users.noreply.github.com> Date: Mon, 19 May 2025 11:36:06 +0600 Subject: [PATCH 1/3] docs: add backticks (#20059) --- config/shared-options.md | 2 +- guide/performance.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/shared-options.md b/config/shared-options.md index c99ece54..3e293575 100644 --- a/config/shared-options.md +++ b/config/shared-options.md @@ -466,7 +466,7 @@ See [here](/guide/env-and-mode#env-files) for more about environment files. - **Type:** `string | string[]` - **Default:** `VITE_` -Env variables starting with `envPrefix` will be exposed to your client source code via import.meta.env. +Env variables starting with `envPrefix` will be exposed to your client source code via `import.meta.env`. :::warning SECURITY NOTES `envPrefix` should not be set as `''`, which will expose all your env variables and cause unexpected leaking of sensitive information. Vite will throw an error when detecting `''`. diff --git a/guide/performance.md b/guide/performance.md index 63971a31..702e10fd 100644 --- a/guide/performance.md +++ b/guide/performance.md @@ -115,7 +115,7 @@ Keeping Vite fast with a growing codebase is about reducing the amount of work f Examples of doing less work: - Use CSS instead of Sass/Less/Stylus when possible (nesting can be handled by PostCSS) -- Don't transform SVGs into UI framework components (React, Vue, etc). Import them as strings or URLs instead. +- Don't transform SVGs into UI framework components (React, Vue, etc.). Import them as strings or URLs instead. - When using `@vitejs/plugin-react`, avoid configuring the Babel options, so it skips the transformation during build (only esbuild will be used). Examples of using native tooling: From ceac5a8781c9bc2b404255ee568ffb718dffcd53 Mon Sep 17 00:00:00 2001 From: Jun Shindo <46585162+jay-es@users.noreply.github.com> Date: Mon, 19 May 2025 14:36:25 +0900 Subject: [PATCH 2/3] docs: remove single quote from buildApp hook (#20057) --- guide/api-environment-frameworks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index 07d30c1a..dcb07004 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -329,7 +329,7 @@ export default { } ``` -Plugins can also define a `buildApp` hook. Order `'pre'` and `null'` are executed before the configured `builder.buildApp`, and order `'post'` hooks are executed after it. `environment.isBuilt` can be used to check if an environment has already being build. +Plugins can also define a `buildApp` hook. Order `'pre'` and `null` are executed before the configured `builder.buildApp`, and order `'post'` hooks are executed after it. `environment.isBuilt` can be used to check if an environment has already being build. ## Environment Agnostic Code From 52b8a225d29d7b310281fc7fccfc687a9b83c508 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Tue, 20 May 2025 10:09:45 +0800 Subject: [PATCH 3/3] fix: resolved conflict --- config/shared-options.md | 6 +----- guide/api-environment-frameworks.md | 6 +----- guide/performance.md | 8 +------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/config/shared-options.md b/config/shared-options.md index b64a3bef..a0ca7903 100644 --- a/config/shared-options.md +++ b/config/shared-options.md @@ -466,11 +466,7 @@ export default defineConfig({ - **类型:** `string | string[]` - **默认:** `VITE_` -<<<<<<< HEAD -以 `envPrefix` 开头的环境变量会通过 import.meta.env 暴露在你的客户端源码中。 -======= -Env variables starting with `envPrefix` will be exposed to your client source code via `import.meta.env`. ->>>>>>> ceac5a8781c9bc2b404255ee568ffb718dffcd53 +以 `envPrefix` 开头的环境变量会通过 `import.meta.env` 暴露在你的客户端源码中。 :::warning 安全注意事项 `envPrefix` 不应被设置为空字符串 `''`,这将暴露你所有的环境变量,导致敏感信息的意外泄漏。 检测到配置为 `''` 时 Vite 将会抛出错误. diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index 344a2e96..11d3b753 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -329,11 +329,7 @@ export default { } ``` -<<<<<<< HEAD -插件还可以定义一个 `buildApp` 钩子。顺序 `'pre'` 和 `null'` 在配置的 `builder.buildApp` 之前执行,顺序 `'post'` 钩子在其之后执行。`environment.isBuilt` 可用于检查环境是否已被构建。 -======= -Plugins can also define a `buildApp` hook. Order `'pre'` and `null` are executed before the configured `builder.buildApp`, and order `'post'` hooks are executed after it. `environment.isBuilt` can be used to check if an environment has already being build. ->>>>>>> ceac5a8781c9bc2b404255ee568ffb718dffcd53 +插件还可以定义一个 `buildApp` 钩子。顺序 `'pre'` 和 `'null'` 在配置的 `builder.buildApp` 之前执行,顺序 `'post'` 钩子在其之后执行。`environment.isBuilt` 可用于检查环境是否已被构建。 ## 环境无关的代码 {#environment-agnostic-code} diff --git a/guide/performance.md b/guide/performance.md index 6e52f97a..c5649204 100644 --- a/guide/performance.md +++ b/guide/performance.md @@ -114,15 +114,9 @@ export default defineConfig({ 精简工作的例子: -<<<<<<< HEAD - 使用 CSS 而不是 Sass/Less/Stylus(可以由 PostCSS 处理嵌套) -- 不要使用 `@vitejs/plugin-react-refresh`,而是使用 React Fast Refresh 的原生支持。 +- 不要将 SVG 转换为 UI 框架组件(例如 React、Vue 等)。请将其作为字符串或 URL 导入。 - 当使用 `@vitejs/plugin-react` 时,避免配置 Babel 选项,这样它就会在构建期间跳过转换(只使用 esbuild)。 -======= -- Use CSS instead of Sass/Less/Stylus when possible (nesting can be handled by PostCSS) -- Don't transform SVGs into UI framework components (React, Vue, etc.). Import them as strings or URLs instead. -- When using `@vitejs/plugin-react`, avoid configuring the Babel options, so it skips the transformation during build (only esbuild will be used). ->>>>>>> ceac5a8781c9bc2b404255ee568ffb718dffcd53 使用更原生化工具链的例子: