From 2733506600bd129276ba8a41ca76edce6f278331 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 19 Aug 2025 21:21:05 -0400 Subject: [PATCH 1/4] docs: minor fixes for punctuation and grammar (#20653) --- guide/assets.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/assets.md b/guide/assets.md index 1edcefaa..e6b4b676 100644 --- a/guide/assets.md +++ b/guide/assets.md @@ -46,7 +46,7 @@ document.getElementById('hero-img').style.background = `url("${imgUrl}")` ### Explicit URL Imports -Assets that are not included in the internal list or in `assetsInclude`, can be explicitly imported as a URL using the `?url` suffix. This is useful, for example, to import [Houdini Paint Worklets](https://developer.mozilla.org/en-US/docs/Web/API/CSS/paintWorklet_static). +Assets that are not included in the internal list or in `assetsInclude` can be explicitly imported as a URL using the `?url` suffix. This is useful, for example, to import [Houdini Paint Worklets](https://developer.mozilla.org/en-US/docs/Web/API/CSS/paintWorklet_static). ```js twoslash import 'vite/client' @@ -167,5 +167,5 @@ function getImageUrl(name) { ::: ::: warning Does not work with SSR -This pattern does not work if you are using Vite for Server-Side Rendering, because `import.meta.url` have different semantics in browsers vs. Node.js. The server bundle also cannot determine the client host URL ahead of time. +This pattern does not work if you are using Vite for Server-Side Rendering, because `import.meta.url` has different semantics in browsers vs. Node.js. The server bundle also cannot determine the client host URL ahead of time. ::: From 052308d89348ca9892ae4ef9cea4f23f1b5e1e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0?= Date: Wed, 20 Aug 2025 10:21:34 +0900 Subject: [PATCH 2/4] docs: update plugins page (#20649) Co-authored-by: Bjorn Lu --- plugins/index.md | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/plugins/index.md b/plugins/index.md index 76eef57b..10e47413 100644 --- a/plugins/index.md +++ b/plugins/index.md @@ -10,31 +10,23 @@ Check out [Using Plugins](../guide/using-plugins) for information on how to use ### [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) -- Provides Vue 3 Single File Components support. +Provides Vue 3 Single File Components support. ### [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) -- Provides Vue 3 JSX support (via [dedicated Babel transform](https://github.com/vuejs/jsx-next)). - -### [@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2) - -- Provides Vue 2.7 Single File Components support. - -### [@vitejs/plugin-vue2-jsx](https://github.com/vitejs/vite-plugin-vue2-jsx) - -- Provides Vue 2.7 JSX support (via [dedicated Babel transform](https://github.com/vuejs/jsx-vue2/)). +Provides Vue 3 JSX support (via [dedicated Babel transform](https://github.com/vuejs/babel-plugin-jsx)). ### [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react) -- Uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the Babel transform pipeline. Without additional Babel plugins, only esbuild is used during builds. +Uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the Babel transform pipeline. Without additional Babel plugins, only esbuild is used during builds. -### [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) +### [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc) -- Replaces Babel with SWC during development. During production builds, SWC+esbuild are used when using plugins, and esbuild only otherwise. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster. +Replaces Babel with SWC during development. During production builds, SWC+esbuild are used when using plugins, and esbuild only otherwise. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster. ### [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) -- Provides legacy browsers support for the production build. +Provides legacy browsers support for the production build. ## Community Plugins From adc95705ba38043a230c6f9eafaf9ee80b618dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0?= Date: Wed, 20 Aug 2025 20:17:09 +0900 Subject: [PATCH 3/4] docs: use root relative paths for internal links (#20656) --- guide/api-plugin.md | 2 +- guide/features.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/guide/api-plugin.md b/guide/api-plugin.md index e4606161..3627a58c 100644 --- a/guide/api-plugin.md +++ b/guide/api-plugin.md @@ -6,7 +6,7 @@ Vite plugins extends Rollup's well-designed plugin interface with a few extra Vi ## Authoring a Plugin -Vite strives to offer established patterns out of the box, so before creating a new plugin make sure that you check the [Features guide](https://vite.dev/guide/features) to see if your need is covered. Also review available community plugins, both in the form of a [compatible Rollup plugin](https://github.com/rollup/awesome) and [Vite Specific plugins](https://github.com/vitejs/awesome-vite#plugins) +Vite strives to offer established patterns out of the box, so before creating a new plugin make sure that you check the [Features guide](/guide/features) to see if your need is covered. Also review available community plugins, both in the form of a [compatible Rollup plugin](https://github.com/rollup/awesome) and [Vite Specific plugins](https://github.com/vitejs/awesome-vite#plugins) When creating a plugin, you can inline it in your `vite.config.js`. There is no need to create a new package for it. Once you see that a plugin was useful in your projects, consider sharing it to help others [in the ecosystem](https://chat.vite.dev). diff --git a/guide/features.md b/guide/features.md index de101970..e696418c 100644 --- a/guide/features.md +++ b/guide/features.md @@ -214,7 +214,7 @@ All modern frameworks maintain integrations with Vite. Most framework plugins ar - React support via [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react) - React using SWC support via [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc) -Check out the [Plugins Guide](https://vite.dev/plugins) for more information. +Check out the [Plugins Guide](/plugins/) for more information. ## JSX @@ -543,7 +543,7 @@ const modules = { #### Custom Queries -You can also use the `query` option to provide queries to imports, for example, to import assets [as a string](https://vite.dev/guide/assets.html#importing-asset-as-string) or [as a url](https://vite.dev/guide/assets.html#importing-asset-as-url): +You can also use the `query` option to provide queries to imports, for example, to import assets [as a string](/guide/assets.html#importing-asset-as-string) or [as a url](/guide/assets.html#importing-asset-as-url): ```ts twoslash import 'vite/client' From a6d1705358f0eae3bffa62f26710c07cb4ba329c Mon Sep 17 00:00:00 2001 From: Kylin <1159469891@qq.com> Date: Thu, 21 Aug 2025 09:42:28 +0800 Subject: [PATCH 4/4] docs: update content --- guide/api-plugin.md | 4 ---- guide/assets.md | 9 --------- guide/features.md | 8 -------- plugins/index.md | 38 +++++--------------------------------- 4 files changed, 5 insertions(+), 54 deletions(-) diff --git a/guide/api-plugin.md b/guide/api-plugin.md index 2042b9f1..ba5aa7ab 100644 --- a/guide/api-plugin.md +++ b/guide/api-plugin.md @@ -6,11 +6,7 @@ Vite 插件扩展了设计出色的 Rollup 接口,带有一些 Vite 独有的 ## 致插件创作者 {#authoring-a-plugin} -<<<<<<< HEAD Vite 努力秉承开箱即用的原则,因此在创作一款新插件前,请确保已经阅读过 [Vite 的功能指南](/guide/features),避免重复劳作。同时还应查看社区是否存在可用插件,包括 [兼容 Rollup 的插件](https://github.com/rollup/awesome) 以及 [Vite 的专属插件](https://github.com/vitejs/awesome-vite#plugins)。 -======= -Vite strives to offer established patterns out of the box, so before creating a new plugin make sure that you check the [Features guide](/guide/features) to see if your need is covered. Also review available community plugins, both in the form of a [compatible Rollup plugin](https://github.com/rollup/awesome) and [Vite Specific plugins](https://github.com/vitejs/awesome-vite#plugins) ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 当创作插件时,你可以在 `vite.config.js` 中直接使用它。没必要直接为它创建一个新的 package。当你发现某个插件在你项目中很有用时,可以考虑 [在社区中](https://chat.vite.dev) 将其与他人分享。 diff --git a/guide/assets.md b/guide/assets.md index 64cbac7f..f7528fc4 100644 --- a/guide/assets.md +++ b/guide/assets.md @@ -46,11 +46,7 @@ document.getElementById('hero-img').style.background = `url("${imgUrl}")` ### 显式 URL 引入 {#explicit-url-imports} -<<<<<<< HEAD 未被包含在内部列表或 `assetsInclude` 中的资源,可以使用 `?url` 后缀显式导入为一个 URL。这十分有用,例如,要导入 [Houdini Paint Worklets](https://developer.mozilla.org/en-US/docs/Web/API/CSS/paintWorklet_static) 时: -======= -Assets that are not included in the internal list or in `assetsInclude` can be explicitly imported as a URL using the `?url` suffix. This is useful, for example, to import [Houdini Paint Worklets](https://developer.mozilla.org/en-US/docs/Web/API/CSS/paintWorklet_static). ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 ```js twoslash import 'vite/client' @@ -170,11 +166,6 @@ function getImageUrl(name) { ::: -<<<<<<< HEAD ::: warning 注意:无法在 SSR 中使用 如果你正在以服务端渲染模式使用 Vite 则此模式不支持,因为 `import.meta.url` 在浏览器和 Node.js 中有不同的语义。服务端的产物也无法预先确定客户端主机 URL。 -======= -::: warning Does not work with SSR -This pattern does not work if you are using Vite for Server-Side Rendering, because `import.meta.url` has different semantics in browsers vs. Node.js. The server bundle also cannot determine the client host URL ahead of time. ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 ::: diff --git a/guide/features.md b/guide/features.md index bc51c7ae..c3cd4945 100644 --- a/guide/features.md +++ b/guide/features.md @@ -214,11 +214,7 @@ HTML 文件位于 Vite 项目的[最前端和中心](/guide/#index-html-and-proj - React 支持:[@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react) - React 使用 SWC 的支持:[@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc) -<<<<<<< HEAD 查看 [插件指南](/plugins/) 了解更多信息。 -======= -Check out the [Plugins Guide](/plugins/) for more information. ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 ## JSX {#jsx} @@ -547,11 +543,7 @@ const modules = { #### 自定义查询 {#custom-queries} -<<<<<<< HEAD 你也可以使用 `query` 选项来提供对导入的自定义查询,比如,可以将资源 [作为字符串引入](/guide/assets#importing-asset-as-string) 或者 [作为 URL 引入](/guide/assets#importing-asset-as-url) : -======= -You can also use the `query` option to provide queries to imports, for example, to import assets [as a string](/guide/assets.html#importing-asset-as-string) or [as a url](/guide/assets.html#importing-asset-as-url): ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 ```ts twoslash import 'vite/client' diff --git a/plugins/index.md b/plugins/index.md index f22057f0..eb014bd7 100644 --- a/plugins/index.md +++ b/plugins/index.md @@ -10,51 +10,23 @@ Vite 旨在为常见的 web 开发工作提供开箱即用的支持。在搜索 ### [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) {#vitejs-plugin-vue} -<<<<<<< HEAD -- 提供 Vue 3 单文件组件支持。 -======= -Provides Vue 3 Single File Components support. ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 +提供 Vue 3 单文件组件支持。 ### [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) {#vitejs-plugin-vue-jsx} -<<<<<<< HEAD -- 提供 Vue 3 JSX 支持(通过 [专用的 Babel 转换插件](https://github.com/vuejs/jsx-next))。 - -### [@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2) {#vitejs-plugin-vue2} - -- 提供对 Vue 2.7 的单文件组件支持。 - -### [@vitejs/plugin-vue2-jsx](https://github.com/vitejs/vite-plugin-vue2-jsx) {#vitejs-plugin-vue2-jsx} - -- 提供对 Vue 2.7 JSX 的支持(通过 [dedicated Babel transform](https://github.com/vuejs/jsx-vue2/))。 -======= -Provides Vue 3 JSX support (via [dedicated Babel transform](https://github.com/vuejs/babel-plugin-jsx)). ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 +提供 Vue 3 JSX 支持(通过 [专用的 Babel 转换插件](https://github.com/vuejs/babel-plugin-jsx)). ### [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react) {#vitejs-plugin-react} -<<<<<<< HEAD -- 使用 esbuild 和 Babel,以较小的软件包占用空间和使用 Babel 转换管道的灵活性实现快速 HMR。如果没有额外的 Babel 插件,在构建过程中只能使用 esbuild。 - -### [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) {#vitejs-plugin-react-swc} - -- 在开发时会将 Babel 替换为 SWC。在生产环境构建期间,若使用了插件则会使用 SWC+esbuild,若没有使用插件则仅会用到 esbuild。对不需要非标准 React 扩展的大型项目,冷启动和模块热替换(HMR)将会有显著提升。 -======= -Uses esbuild and Babel, achieving fast HMR with a small package footprint and the flexibility of being able to use the Babel transform pipeline. Without additional Babel plugins, only esbuild is used during builds. +使用 esbuild 和 Babel,以较小的软件包占用空间和使用 Babel 转换管道的灵活性实现快速 HMR。如果没有额外的 Babel 插件,在构建过程中只能使用 esbuild。 ### [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc) -Replaces Babel with SWC during development. During production builds, SWC+esbuild are used when using plugins, and esbuild only otherwise. For big projects that don't require non-standard React extensions, cold start and Hot Module Replacement (HMR) can be significantly faster. ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 +在开发时会将 Babel 替换为 SWC。在生产环境构建期间,若使用了插件则会使用 SWC+esbuild,若没有使用插件则仅会用到 esbuild。对不需要非标准 React 扩展的大型项目,冷启动和模块热替换(HMR)将会有显著提升。 ### [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) {#vitejs-plugin-legacy} -<<<<<<< HEAD -- 为打包后的文件提供传统浏览器兼容性支持。 -======= -Provides legacy browsers support for the production build. ->>>>>>> adc95705ba38043a230c6f9eafaf9ee80b618dc1 +为打包后的文件提供传统浏览器兼容性支持。 ## 社区插件 {#community-plugins}