From 1318b6fb802525823c7d70c164edde66fa3179d0 Mon Sep 17 00:00:00 2001 From: "@beer" <47961062+iiio2@users.noreply.github.com> Date: Sat, 10 May 2025 17:14:09 +0600 Subject: [PATCH 1/2] docs: tweak wordings in vite doc (#20018) --- .vitepress/config.ts | 6 +++--- blog/announcing-vite5.md | 2 +- changes/index.md | 6 +++--- changes/per-environment-apis.md | 2 +- changes/ssr-using-modulerunner.md | 2 +- config/index.md | 2 +- guide/api-environment-frameworks.md | 2 +- guide/api-environment.md | 6 +++--- guide/api-plugin.md | 2 +- guide/performance.md | 2 +- guide/rolldown.md | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 24dfc2a0..9cbee948 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -422,15 +422,15 @@ export default defineConfig({ link: '/changes/hotupdate-hook', }, { - text: 'Move to per-environment APIs', + text: 'Move to Per-environment APIs', link: '/changes/per-environment-apis', }, { - text: 'SSR using ModuleRunner API', + text: 'SSR Using ModuleRunner API', link: '/changes/ssr-using-modulerunner', }, { - text: 'Shared plugins during build', + text: 'Shared Plugins During Build', link: '/changes/shared-plugins-during-build', }, ], diff --git a/blog/announcing-vite5.md b/blog/announcing-vite5.md index 06346382..e44e452b 100644 --- a/blog/announcing-vite5.md +++ b/blog/announcing-vite5.md @@ -33,7 +33,7 @@ _November 16, 2023_ Vite 4 [was released](./announcing-vite4.md) almost a year ago, and it served as a solid base for the ecosystem. npm downloads per week jumped from 2.5 million to 7.5 million, as projects keep building on a shared infrastructure. Frameworks continued to innovate, and on top of [Astro](https://astro.build/), [Nuxt](https://nuxt.com/), [SvelteKit](https://kit.svelte.dev/), [Solid Start](https://www.solidjs.com/blog/introducing-solidstart), [Qwik City](https://qwik.builder.io/qwikcity/overview/), between others, we saw new frameworks joining and making the ecosystem stronger. [RedwoodJS](https://redwoodjs.com/) and [Remix](https://remix.run/) switching to Vite paves the way for further adoption in the React ecosystem. [Vitest](https://vitest.dev) kept growing at an even faster pace than Vite. Its team has been hard at work and will soon [release Vitest 1.0](https://github.com/vitest-dev/vitest/issues/3596). The story of Vite when used with other tools such as [Storybook](https://storybook.js.org), [Nx](https://nx.dev), and [Playwright](https://playwright.dev) kept improving, and the same goes for environments, with Vite dev working both in [Deno](https://deno.com) and [Bun](https://bun.sh). -We had the second edition of [ViteConf](https://viteconf.org/23/replay) a month ago, hosted by [StackBlitz](https://stackblitz.com). Like last year, most of the projects in the ecosystem got together to share ideas and connect to keep expanding the commons. We're also seeing new pieces complement the meta-framework tool belt like [Volar](https://volarjs.dev/) and [Nitro](https://nitro.unjs.io/). The Rollup team released [Rollup 4](https://rollupjs.org) that same day, a tradition Lukas started last year. +We had the second edition of [ViteConf](https://viteconf.org/23/replay) a month ago, hosted by [StackBlitz](https://stackblitz.com). Like last year, most of the projects in the ecosystem got together to share ideas and connect to keep expanding the commons. We're also seeing new pieces complement the meta-framework tool belt like [Volar](https://volarjs.dev/) and [Nitro](https://nitro.build/). The Rollup team released [Rollup 4](https://rollupjs.org) that same day, a tradition Lukas started last year. Six months ago, Vite 4.3 [was released](./announcing-vite4.md). This release significantly improved the dev server performance. However, there is still ample room for improvement. At ViteConf, [Evan You unveiled Vite's long-term plan to work on Rolldown](https://www.youtube.com/watch?v=hrdwQHoAp0M), a Rust-port of Rollup with compatible APIs. Once it is ready, we intend to use it in Vite Core to take on the tasks of both Rollup and esbuild. This will mean a boost in build performance (and later on in dev performance too as we move perf-sensitive parts of Vite itself to Rust), and a big reduction of inconsistencies between dev and build. Rolldown is currently in early stages and the team is preparing to open source the codebase before the end of the year. Stay tuned! diff --git a/changes/index.md b/changes/index.md index 7607ae2d..45568483 100644 --- a/changes/index.md +++ b/changes/index.md @@ -16,9 +16,9 @@ We don't recommend switching to these APIs yet. They are included in Vite to hel - [`this.environment` in Hooks](/changes/this-environment-in-hooks) - [HMR `hotUpdate` Plugin Hook](/changes/hotupdate-hook) -- [Move to per-environment APIs](/changes/per-environment-apis) -- [SSR using `ModuleRunner` API](/changes/ssr-using-modulerunner) -- [Shared plugins during build](/changes/shared-plugins-during-build) +- [Move to Per-environment APIs](/changes/per-environment-apis) +- [SSR Using `ModuleRunner` API](/changes/ssr-using-modulerunner) +- [Shared Plugins During Build](/changes/shared-plugins-during-build) ## Past diff --git a/changes/per-environment-apis.md b/changes/per-environment-apis.md index 4ff27380..d44da296 100644 --- a/changes/per-environment-apis.md +++ b/changes/per-environment-apis.md @@ -1,4 +1,4 @@ -# Move to per-environment APIs +# Move to Per-environment APIs ::: tip Feedback Give us feedback at [Environment API feedback discussion](https://github.com/vitejs/vite/discussions/16358) diff --git a/changes/ssr-using-modulerunner.md b/changes/ssr-using-modulerunner.md index 2fd80ebc..4b474e2a 100644 --- a/changes/ssr-using-modulerunner.md +++ b/changes/ssr-using-modulerunner.md @@ -1,4 +1,4 @@ -# SSR using `ModuleRunner` API +# SSR Using `ModuleRunner` API ::: tip Feedback Give us feedback at [Environment API feedback discussion](https://github.com/vitejs/vite/discussions/16358) diff --git a/config/index.md b/config/index.md index 02a97194..d2dde8d5 100644 --- a/config/index.md +++ b/config/index.md @@ -14,7 +14,7 @@ export default { } ``` -Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM, e.g. `type: "module"` in `package.json`. In this case, the config file is auto pre-processed before load. +Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM, e.g. `"type": "module"` in `package.json`. In this case, the config file is auto pre-processed before load. You can also explicitly specify a config file to use with the `--config` CLI option (resolved relative to `cwd`): diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index 96eeece2..3eac0479 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -11,7 +11,7 @@ Resources: Please share your feedback with us. ::: -## Environments and frameworks +## Environments and Frameworks The implicit `ssr` environment and other non-client environments use a `RunnableDevEnvironment` by default during dev. While this requires the runtime to be the same with the one the Vite server is running in, this works similarly with `ssrLoadModule` and allows frameworks to migrate and enable HMR for their SSR dev story. You can guard any runnable environment with an `isRunnableDevEnvironment` function. diff --git a/guide/api-environment.md b/guide/api-environment.md index 4c827788..1ae938c9 100644 --- a/guide/api-environment.md +++ b/guide/api-environment.md @@ -125,9 +125,9 @@ We don't recommend switching to Environment API yet. We are aiming for a good po - [`this.environment` in Hooks](/changes/this-environment-in-hooks) - [HMR `hotUpdate` Plugin Hook](/changes/hotupdate-hook) -- [Move to per-environment APIs](/changes/per-environment-apis) -- [SSR using `ModuleRunner` API](/changes/ssr-using-modulerunner) -- [Shared plugins during build](/changes/shared-plugins-during-build) +- [Move to Per-environment APIs](/changes/per-environment-apis) +- [SSR Using `ModuleRunner` API](/changes/ssr-using-modulerunner) +- [Shared Plugins During Build](/changes/shared-plugins-during-build) ## Target Users diff --git a/guide/api-plugin.md b/guide/api-plugin.md index b8ef5fb2..867ba2c6 100644 --- a/guide/api-plugin.md +++ b/guide/api-plugin.md @@ -38,7 +38,7 @@ If your plugin is only going to work for a particular framework, its name should See also [Virtual Modules Convention](#virtual-modules-convention). -## Plugins config +## Plugins Config Users will add plugins to the project `devDependencies` and configure them using the `plugins` array option. diff --git a/guide/performance.md b/guide/performance.md index c008c8e6..63971a31 100644 --- a/guide/performance.md +++ b/guide/performance.md @@ -6,7 +6,7 @@ While Vite is fast by default, performance issues can creep in as the project's - Slow page loads - Slow builds -## Review your Browser Setup +## Review Your Browser Setup Some browser extensions may interfere with requests and slow down startup and reload times for large apps, especially when using browser dev tools. We recommend creating a dev-only profile without extensions, or switch to incognito mode, while using Vite's dev server in these cases. Incognito mode should also be faster than a regular profile without extensions. diff --git a/guide/rolldown.md b/guide/rolldown.md index f810c5d5..7b50f752 100644 --- a/guide/rolldown.md +++ b/guide/rolldown.md @@ -177,7 +177,7 @@ With the Rolldown integration, we have an opportunity to unify the development a When the Full Bundle Mode is introduced, it will be an opt-in feature at first. Similar to the Rolldown integration, we are aiming to make it the default after gathering feedback and ensuring stability. -## Plugin / Framework authors guide +## Plugin / Framework Authors Guide ::: tip This section is mostly relevant for plugin and framework authors. If you are a user, you can skip this section. From 2d158f0698933e9f6a52a51f2b7a138339bf8f32 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Sun, 11 May 2025 12:42:05 +0800 Subject: [PATCH 2/2] fix: resolved conflict --- .vitepress/config.ts | 12 ------------ blog/announcing-vite5.md | 6 +----- changes/index.md | 8 -------- changes/per-environment-apis.md | 4 ---- changes/ssr-using-modulerunner.md | 4 ---- config/index.md | 6 +----- guide/api-environment-frameworks.md | 4 ---- guide/api-environment.md | 8 -------- guide/api-plugin.md | 4 ---- guide/performance.md | 4 ---- guide/rolldown.md | 6 +----- 11 files changed, 3 insertions(+), 63 deletions(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 267dfd61..4735b086 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -465,7 +465,6 @@ export default defineConfig({ link: '/changes/hotupdate-hook', }, { -<<<<<<< HEAD text: '迁移到基于环境的API', link: '/changes/per-environment-apis', }, @@ -475,17 +474,6 @@ export default defineConfig({ }, { text: '构建过程中的共享插件', -======= - text: 'Move to Per-environment APIs', - link: '/changes/per-environment-apis', - }, - { - text: 'SSR Using ModuleRunner API', - link: '/changes/ssr-using-modulerunner', - }, - { - text: 'Shared Plugins During Build', ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 link: '/changes/shared-plugins-during-build', }, ], diff --git a/blog/announcing-vite5.md b/blog/announcing-vite5.md index b69ff31a..e15ead42 100644 --- a/blog/announcing-vite5.md +++ b/blog/announcing-vite5.md @@ -33,11 +33,7 @@ _2023年11月16日_ Vite 4 发布了将近一年,它为生态系统奠定了坚实的基础。每周的 npm 下载量从250万增加到了750万,因为项目不断在共享基础设施上构建。各种框架不断创新,除了 [Astro](https://astro.build/)、[Nuxt](https://nuxt.com/)、[SvelteKit](https://kit.svelte.dev/)、[Solid Start](https://www.solidjs.com/blog/introducing-solidstart)、[Qwik City](https://qwik.builder.io/qwikcity/overview/) 等等之外,我们看到新的框架加入并使生态系统变得更加强大。[RedwoodJS](https://redwoodjs.com/) 和 [Remix](https://remix.run/) 转向 Vite 为 React 生态系统的进一步采用铺平了道路。[Vitest](https://vitest.dev) 的增长速度甚至比 Vite 还要快。其团队一直在努力工作,并将很快 [发布 Vitest 1.0](https://github.com/vitest-dev/vitest/issues/3596)。当与其他工具一起使用时,如 [Storybook](https://storybook.js.org)、[Nx](https://nx.dev) 和 [Playwright](https://playwright.dev),Vite 的故事不断改善,环境也是如此,Vite 的开发在 [Deno](https://deno.com) 和 [Bun](https://bun.sh) 中都可以工作。 -<<<<<<< HEAD -一个月前,我们举办了第二届 [ViteConf](https://viteconf.org/23/replay),由 [StackBlitz](https://stackblitz.com) 主办。像去年一样,生态系统中的大多数项目聚在一起分享想法,并保持连接以持续扩展共同体。我们也看到新的组件补充了元框架工具包,比如 [Volar](https://volarjs.dev/) 和 [Nitro](https://nitro.unjs.io/)。Rollup 团队在同一天发布了 [Rollup 4](https://cn.rollupjs.org),这是去年 Lukas 开创的传统。 -======= -We had the second edition of [ViteConf](https://viteconf.org/23/replay) a month ago, hosted by [StackBlitz](https://stackblitz.com). Like last year, most of the projects in the ecosystem got together to share ideas and connect to keep expanding the commons. We're also seeing new pieces complement the meta-framework tool belt like [Volar](https://volarjs.dev/) and [Nitro](https://nitro.build/). The Rollup team released [Rollup 4](https://rollupjs.org) that same day, a tradition Lukas started last year. ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 +一个月前,我们举办了第二届 [ViteConf](https://viteconf.org/23/replay),由 [StackBlitz](https://stackblitz.com) 主办。像去年一样,生态系统中的大多数项目聚在一起分享想法,并保持连接以持续扩展共同体。我们也看到新的组件补充了元框架工具包,比如 [Volar](https://volarjs.dev/) 和 [Nitro](https://nitro.build/)。Rollup 团队在同一天发布了 [Rollup 4](https://cn.rollupjs.org),这是去年 Lukas 开创的传统。 六个月前,Vite 4.3 [发布了](./announcing-vite4.md)。这个版本显著改善了开发服务器的性能。但是,还有很大的改进空间。在 ViteConf 上,[Evan You 揭示了 Vite 的长期计划,即着手开发 Rolldown](https://www.youtube.com/watch?v=hrdwQHoAp0M),这是 Rollup 的 Rust 版本,具有兼容的 API。一旦准备就绪,我们打算在 Vite Core 中使用它,以执行 Rollup 和 esbuild 的任务。这将意味着构建性能的提升(随着我们将 Vite 本身的性能敏感部分转移到 Rust,开发性能也将在以后提升),以及减少开发和构建之间的不一致性。Rolldown 目前处于早期阶段,团队正准备在年底之前开源代码库。敬请期待! diff --git a/changes/index.md b/changes/index.md index 05c68e2f..b5392af7 100644 --- a/changes/index.md +++ b/changes/index.md @@ -14,19 +14,11 @@ Vite 中的破坏性变更列表,包括 API 废弃、移除和变更。在你 我们目前还不建议你切换到这些 API。我们将它们包含在 Vite 中是为了帮助我们收集反馈。请查看这些提案,并在每个提案相关联的 GitHub Discussions 中告诉我们它们在你的使用场景中的表现如何。 -<<<<<<< HEAD - [钩子函数中的 `this.environment`](/changes/this-environment-in-hooks) - [HMR `hotUpdate` 插件钩子](/changes/hotupdate-hook) - [迁移到基于环境的API](/changes/per-environment-apis) - [使用 `ModuleRunner` API 进行服务端渲染](/changes/ssr-using-modulerunner) - [构建过程中的共享插件](/changes/shared-plugins-during-build) -======= -- [`this.environment` in Hooks](/changes/this-environment-in-hooks) -- [HMR `hotUpdate` Plugin Hook](/changes/hotupdate-hook) -- [Move to Per-environment APIs](/changes/per-environment-apis) -- [SSR Using `ModuleRunner` API](/changes/ssr-using-modulerunner) -- [Shared Plugins During Build](/changes/shared-plugins-during-build) ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 ## 历史 {#past} diff --git a/changes/per-environment-apis.md b/changes/per-environment-apis.md index 2f3424aa..214e6aa9 100644 --- a/changes/per-environment-apis.md +++ b/changes/per-environment-apis.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD # 迁移到基于环境的API {#move-to-per-environment-apis} -======= -# Move to Per-environment APIs ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 ::: tip 反馈 可以在 [环境 API 讨论](https://github.com/vitejs/vite/discussions/16358) 中向我们提供反馈 diff --git a/changes/ssr-using-modulerunner.md b/changes/ssr-using-modulerunner.md index bf246719..623d8e0e 100644 --- a/changes/ssr-using-modulerunner.md +++ b/changes/ssr-using-modulerunner.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD # 使用 ModuleRunner API 进行服务端渲染 {#ssr-using-modulerunner-api} -======= -# SSR Using `ModuleRunner` API ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 ::: tip 反馈 可以在 [环境 API 讨论](https://github.com/vitejs/vite/discussions/16358) 中向我们提供反馈 diff --git a/config/index.md b/config/index.md index d53f3b28..a0e9815c 100644 --- a/config/index.md +++ b/config/index.md @@ -14,11 +14,7 @@ export default { } ``` -<<<<<<< HEAD -注意:即使项目没有在 `package.json` 中开启 `type: "module"`,Vite 也支持在配置文件中使用 ESM 语法。这种情况下,配置文件会在被加载前自动进行预处理。 -======= -Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM, e.g. `"type": "module"` in `package.json`. In this case, the config file is auto pre-processed before load. ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 +注意:即使项目没有在 `package.json` 中开启 `"type": "module"`,Vite 也支持在配置文件中使用 ESM 语法。这种情况下,配置文件会在被加载前自动进行预处理。 你可以显式地通过 `--config` 命令行选项指定一个配置文件(相对于 `cwd` 路径进行解析) diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index f6f0917f..1b049421 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -11,11 +11,7 @@ 请与我们分享您的反馈。 ::: -<<<<<<< HEAD ## 环境和框架 {#environments-and-frameworks} -======= -## Environments and Frameworks ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 隐式的 `ssr` 环境和其他非客户端环境在开发过程中默认使用 `RunnableDevEnvironment`。虽然这要求运行时与 Vite 服务器运行的环境相同,但这与 `ssrLoadModule` 类似,允许框架迁移并为其 SSR 开发方案启用模块热替换(HMR)。你可以使用 `isRunnableDevEnvironment` 函数来保护任何可运行的环境。 diff --git a/guide/api-environment.md b/guide/api-environment.md index 5e55c1e5..8eb5361b 100644 --- a/guide/api-environment.md +++ b/guide/api-environment.md @@ -123,19 +123,11 @@ export default { 我们不建议现在就切换到环境 API。我们的目标是在插件不需要维护两个版本之前,让大部分用户基础采用 Vite 6。查看未来破坏性更改部分以获取未来弃用和升级路径的信息: -<<<<<<< HEAD - [钩子函数中的 `this.environment`](/changes/this-environment-in-hooks) - [HMR `hotUpdate` 插件钩子](/changes/hotupdate-hook) - [迁移到基于环境的API](/changes/per-environment-apis) - [使用 `ModuleRunner` API 进行服务端渲染](/changes/ssr-using-modulerunner) - [构建过程中的共享插件](/changes/shared-plugins-during-build) -======= -- [`this.environment` in Hooks](/changes/this-environment-in-hooks) -- [HMR `hotUpdate` Plugin Hook](/changes/hotupdate-hook) -- [Move to Per-environment APIs](/changes/per-environment-apis) -- [SSR Using `ModuleRunner` API](/changes/ssr-using-modulerunner) -- [Shared Plugins During Build](/changes/shared-plugins-during-build) ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 ## 目标用户 {#target-users} diff --git a/guide/api-plugin.md b/guide/api-plugin.md index a990fef8..305d09da 100644 --- a/guide/api-plugin.md +++ b/guide/api-plugin.md @@ -38,11 +38,7 @@ Vite 努力秉承开箱即用的原则,因此在创作一款新插件前,请 更多详情参见 [虚拟模块的相关内容](#virtual-modules-convention). -<<<<<<< HEAD ## 插件配置 {#plugins-config} -======= -## Plugins Config ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 用户会将插件添加到项目的 `devDependencies` 中并使用数组形式的 `plugins` 选项配置它们。 diff --git a/guide/performance.md b/guide/performance.md index f76ddec0..c8e6a793 100644 --- a/guide/performance.md +++ b/guide/performance.md @@ -6,11 +6,7 @@ - 页面加载慢 - 构建慢 -<<<<<<< HEAD ## 检查浏览器设置 {#review-your-browser-setup} -======= -## Review Your Browser Setup ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 有些浏览器插件可能会干涉请求,对于大型应用,特别是在使用浏览器开发工具时,可能会拖慢启动和刷新速度。我们建议在这种情况下,使用 Vite 的开发服务器时,创建一个专门用于开发且不含插件的配置,或者切换到无痕模式。无痕模式的速度也应该比没有插件的常规模式更快。 diff --git a/guide/rolldown.md b/guide/rolldown.md index 2e7e75d2..6be84b45 100644 --- a/guide/rolldown.md +++ b/guide/rolldown.md @@ -177,11 +177,7 @@ Vite 以其非打包开发服务器方案著称,这正是其早期凭借速度 该模式初期将作为可选特性提供(类似 Rolldown 整合方案),我们计划在收集反馈并确保稳定性后将其设为默认模式。 -<<<<<<< HEAD -## 插件/框架作者指南 {#plugin-framework-authors-guide} -======= -## Plugin / Framework Authors Guide ->>>>>>> 1318b6fb802525823c7d70c164edde66fa3179d0 +## 插件 / 框架作者指南 {#plugin-framework-authors-guide} ::: tip 这部分内容主要是针对插件和框架的开发者。如果你是一般用户,你可以忽略这部分内容。