Skip to content

Commit 8838a16

Browse files
authored
Merge pull request #1226 from kovsu/chore-1
docs(cn): update rollup links to cn documentation
2 parents 9f42552 + f4460bc commit 8838a16

16 files changed

+38
-38
lines changed

.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ Vite is a new breed of frontend build tooling that significantly improves the fr
528528
529529
- A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vite.dev/guide/features.md) and astonishingly fast [Hot Module Replacement (HMR)](https://vite.dev/guide/features.md#hot-module-replacement).
530530
531-
- A [build command](https://vite.dev/guide/build.md) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production.
531+
- A [build command](https://vite.dev/guide/build.md) that bundles your code with [Rollup](https://cn.rollupjs.org), pre-configured to output highly optimized static assets for production.
532532
533533
In addition, Vite is highly extensible via its [Plugin API](https://vite.dev/guide/api-plugin.md) and [JavaScript API](https://vite.dev/guide/api-javascript.md) with full typing support.`,
534534
}) as PluginOption,

blog/announcing-vite4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Vite 3 [was released](./announcing-vite3.md) five months ago. npm downloads per
3333

3434
[![Vite 4 Ecosystem](/ecosystem-vite4.png)](https://viteconf.org/2022/replay)
3535

36-
As a showcase of the growth Vite and related projects have experienced, the Vite ecosystem gathered on October 11th at [ViteConf 2022](https://viteconf.org/2022/replay). We saw representatives from the main web framework and tools tell stories of innovation and collaboration. And in a symbolic move, the Rollup team choose that exact day to release [Rollup 3](https://rollupjs.org).
36+
As a showcase of the growth Vite and related projects have experienced, the Vite ecosystem gathered on October 11th at [ViteConf 2022](https://viteconf.org/2022/replay). We saw representatives from the main web framework and tools tell stories of innovation and collaboration. And in a symbolic move, the Rollup team choose that exact day to release [Rollup 3](https://cn.rollupjs.org).
3737

3838
Today, the Vite [team](https://vite.dev/team) with the help of our ecosystem partners, is happy to announce the release of Vite 4, powered during build time by Rollup 3. We've worked with the ecosystem to ensure a smooth upgrade path for this new major. Vite is now using [Rollup 3](https://github.com/vitejs/vite/issues/9870), which allowed us to simplify Vite's internal asset handling and has many improvements. See the [Rollup 3 release notes here](https://github.com/rollup/rollup/releases/tag/v3.0.0).
3939

blog/announcing-vite5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ _2023年11月16日_
3333

3434
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) 中都可以工作。
3535

36-
一个月前,我们举办了第二届 [ViteConf](https://viteconf.org/23/replay),由 [StackBlitz](https://stackblitz.com) 主办。像去年一样,生态系统中的大多数项目聚在一起分享想法,并保持连接以持续扩展共同体。我们也看到新的组件补充了元框架工具包,比如 [Volar](https://volarjs.dev/)[Nitro](https://nitro.unjs.io/)。Rollup 团队在同一天发布了 [Rollup 4](https://rollupjs.org),这是去年 Lukas 开创的传统。
36+
一个月前,我们举办了第二届 [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 开创的传统。
3737

3838
六个月前,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 目前处于早期阶段,团队正准备在年底之前开源代码库。敬请期待!
3939

config/build-options.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ Git LFS 占位符会自动排除在内联之外,因为它们不包含其所表
143143

144144
## build.rollupOptions {#build-rollupoptions}
145145

146-
- **类型:** [`RollupOptions`](https://rollupjs.org/configuration-options/)
146+
- **类型:** [`RollupOptions`](https://cn.rollupjs.org/configuration-options/)
147147

148-
自定义底层的 Rollup 打包配置。这与从 Rollup 配置文件导出的选项相同,并将与 Vite 的内部 Rollup 选项合并。查看 [Rollup 选项文档](https://rollupjs.org/configuration-options/) 获取更多细节。
148+
自定义底层的 Rollup 打包配置。这与从 Rollup 配置文件导出的选项相同,并将与 Vite 的内部 Rollup 选项合并。查看 [Rollup 选项文档](https://cn.rollupjs.org/configuration-options/) 获取更多细节。
149149

150150
## build.commonjsOptions {#build-commonjsoptions}
151151

@@ -287,7 +287,7 @@ npm add -D terser
287287

288288
## build.watch {#build-watch}
289289

290-
- **类型:** [`WatcherOptions`](https://rollupjs.org/configuration-options/#watch)`| null`
290+
- **类型:** [`WatcherOptions`](https://cn.rollupjs.org/configuration-options/#watch)`| null`
291291
- **默认:** `null`
292292

293293
设置为 `{}` 则会启用 rollup 的监听器。对于只在构建阶段或者集成流程使用的插件很常用。

config/server-options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ export default defineConfig({
404404

405405
是否忽略服务器 sourcemap 中的源文件,用于填充 [`x_google_ignoreList` source map 扩展](https://developer.chrome.com/articles/x-google-ignore-list/)
406406

407-
对开发服务器来说 `server.sourcemapIgnoreList` 等价于 [`build.rollupOptions.output.sourcemapIgnoreList`](https://rollupjs.org/configuration-options/#output-sourcemapignorelist)。两个配置选项之间的区别在于,rollup 函数使用相对路径调用 `sourcePath`,而 `server.sourcemapIgnoreList` 使用绝对路径调用。在开发过程中,大多数模块的映射和源文件位于同一个文件夹中,因此 `sourcePath` 的相对路径就是文件名本身。在这些情况下,使用绝对路径更加方便。
407+
对开发服务器来说 `server.sourcemapIgnoreList` 等价于 [`build.rollupOptions.output.sourcemapIgnoreList`](https://cn.rollupjs.org/configuration-options/#output-sourcemapignorelist)。两个配置选项之间的区别在于,rollup 函数使用相对路径调用 `sourcePath`,而 `server.sourcemapIgnoreList` 使用绝对路径调用。在开发过程中,大多数模块的映射和源文件位于同一个文件夹中,因此 `sourcePath` 的相对路径就是文件名本身。在这些情况下,使用绝对路径更加方便。
408408

409409
默认情况下,它会排除所有包含 `node_modules` 的路径。你可以传递 `false` 来禁用此行为,或者为了获得完全的控制,可以传递一个函数,该函数接受源路径和 sourcemap 的路径,并返回是否忽略源路径。
410410

@@ -421,5 +421,5 @@ export default defineConfig({
421421
```
422422

423423
::: tip 注意
424-
需要单独设置 [`server.sourcemapIgnoreList`](#server-sourcemapignorelist)[`build.rollupOptions.output.sourcemapIgnoreList`](https://rollupjs.org/configuration-options/#output-sourcemapignorelist)`server.sourcemapIgnoreList` 是一个仅适用于服务端的配置,并不从定义好的 rollup 选项中获得其默认值。
424+
需要单独设置 [`server.sourcemapIgnoreList`](#server-sourcemapignorelist)[`build.rollupOptions.output.sourcemapIgnoreList`](https://cn.rollupjs.org/configuration-options/#output-sourcemapignorelist)`server.sourcemapIgnoreList` 是一个仅适用于服务端的配置,并不从定义好的 rollup 选项中获得其默认值。
425425
:::

config/worker-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ worker 打包时的输出类型。
1818

1919
## worker.rollupOptions
2020

21-
- **类型:** [`RollupOptions`](https://rollupjs.org/configuration-options/)
21+
- **类型:** [`RollupOptions`](https://cn.rollupjs.org/configuration-options/)
2222

2323
用于打包 worker 的 Rollup 配置项。

guide/api-plugin.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Vite 插件扩展了设计出色的 Rollup 接口,带有一些 Vite 独有的配置项。因此,你只需要编写一个 Vite 插件,就可以同时为开发环境和生产环境工作。
44

5-
**推荐在阅读下面的章节之前,首先阅读下 [Rollup 插件文档](https://rollupjs.org/plugin-development/)**
5+
**推荐在阅读下面的章节之前,首先阅读下 [Rollup 插件文档](https://cn.rollupjs.org/plugin-development/)**
66

77
## 致插件创作者 {#authoring-a-plugin}
88

@@ -17,7 +17,7 @@ Vite 努力秉承开箱即用的原则,因此在创作一款新插件前,请
1717

1818
## 约定 {#conventions}
1919

20-
如果插件不使用 Vite 特有的钩子,可以作为 [兼容 Rollup 的插件](#rollup-plugin-compatibility) 来实现,推荐使用 [Rollup 插件名称约定](https://rollupjs.org/plugin-development/#conventions)
20+
如果插件不使用 Vite 特有的钩子,可以作为 [兼容 Rollup 的插件](#rollup-plugin-compatibility) 来实现,推荐使用 [Rollup 插件名称约定](https://cn.rollupjs.org/plugin-development/#conventions)
2121

2222
- Rollup 插件应该有一个带 `rollup-plugin-` 前缀、语义清晰的名称。
2323
- 在 package.json 中包含 `rollup-plugin``vite-plugin` 关键字。
@@ -144,31 +144,31 @@ console.log(msg)
144144

145145
## 通用钩子 {#universal-hooks}
146146

147-
在开发中,Vite 开发服务器会创建一个插件容器来调用 [Rollup 构建钩子](https://rollupjs.org/plugin-development/#build-hooks),与 Rollup 如出一辙。
147+
在开发中,Vite 开发服务器会创建一个插件容器来调用 [Rollup 构建钩子](https://cn.rollupjs.org/plugin-development/#build-hooks),与 Rollup 如出一辙。
148148

149149
以下钩子在服务器启动时被调用:
150150

151-
- [`options`](https://rollupjs.org/plugin-development/#options)
152-
- [`buildStart`](https://rollupjs.org/plugin-development/#buildstart)
151+
- [`options`](https://cn.rollupjs.org/plugin-development/#options)
152+
- [`buildStart`](https://cn.rollupjs.org/plugin-development/#buildstart)
153153

154154
以下钩子会在每个传入模块请求时被调用:
155155

156-
- [`resolveId`](https://rollupjs.org/plugin-development/#resolveid)
157-
- [`load`](https://rollupjs.org/plugin-development/#load)
158-
- [`transform`](https://rollupjs.org/plugin-development/#transform)
156+
- [`resolveId`](https://cn.rollupjs.org/plugin-development/#resolveid)
157+
- [`load`](https://cn.rollupjs.org/plugin-development/#load)
158+
- [`transform`](https://cn.rollupjs.org/plugin-development/#transform)
159159

160160
它们还有一个扩展的 `options` 参数,包含其他特定于 Vite 的属性。你可以在 [SSR 文档](/guide/ssr#ssr-specific-plugin-logic) 中查阅更多内容。
161161

162162
一些 `resolveId` 调用的 `importer` 值可能是根目录下的通用 `index.html` 的绝对路径,这是由于 Vite 非打包的开发服务器模式无法始终推断出实际的导入者。对于在 Vite 的解析管道中处理的导入,可以在导入分析阶段跟踪导入者,提供正确的 `importer` 值。
163163

164164
以下钩子在服务器关闭时被调用:
165165

166-
- [`buildEnd`](https://rollupjs.org/plugin-development/#buildend)
167-
- [`closeBundle`](https://rollupjs.org/plugin-development/#closebundle)
166+
- [`buildEnd`](https://cn.rollupjs.org/plugin-development/#buildend)
167+
- [`closeBundle`](https://cn.rollupjs.org/plugin-development/#closebundle)
168168

169-
请注意 [`moduleParsed`](https://rollupjs.org/plugin-development/#moduleparsed) 钩子在开发中是 **不会** 被调用的,因为 Vite 为了性能会避免完整的 AST 解析。
169+
请注意 [`moduleParsed`](https://cn.rollupjs.org/plugin-development/#moduleparsed) 钩子在开发中是 **不会** 被调用的,因为 Vite 为了性能会避免完整的 AST 解析。
170170

171-
[Output Generation Hooks](https://rollupjs.org/plugin-development/#output-generation-hooks)(除了 `closeBundle`) 在开发中是 **不会** 被调用的。你可以认为 Vite 的开发服务器只调用了 `rollup.rollup()` 而没有调用 `bundle.generate()`
171+
[Output Generation Hooks](https://cn.rollupjs.org/plugin-development/#output-generation-hooks)(除了 `closeBundle`) 在开发中是 **不会** 被调用的。你可以认为 Vite 的开发服务器只调用了 `rollup.rollup()` 而没有调用 `bundle.generate()`
172172

173173
## Vite 独有钩子 {#vite-specific-hooks}
174174

@@ -479,7 +479,7 @@ Vite 插件也可以提供钩子来服务于特定的 Vite 目标。这些钩子
479479
- 带有 `enforce: 'post'` 的用户插件
480480
- Vite 后置构建插件(最小化,manifest,报告)
481481

482-
请注意,这与钩子的排序是分开的,钩子的顺序仍然会受到它们的 `order` 属性的影响,这一点 [和 Rollup 钩子的表现一样](https://rollupjs.org/plugin-development/#build-hooks)。
482+
请注意,这与钩子的排序是分开的,钩子的顺序仍然会受到它们的 `order` 属性的影响,这一点 [和 Rollup 钩子的表现一样](https://cn.rollupjs.org/plugin-development/#build-hooks)。
483483

484484
## 情景应用 {#conditional-application}
485485

@@ -509,7 +509,7 @@ apply(config, { command }) {
509509

510510
一般来说,只要 Rollup 插件符合以下标准,它就应该像 Vite 插件一样工作:
511511

512-
- 没有使用 [`moduleParsed`](https://rollupjs.org/plugin-development/#moduleparsed) 钩子。
512+
- 没有使用 [`moduleParsed`](https://cn.rollupjs.org/plugin-development/#moduleparsed) 钩子。
513513
- 它在打包钩子和输出钩子之间没有很强的耦合。
514514

515515
如果一个 Rollup 插件只在构建阶段有意义,则在 `build.rollupOptions.plugins` 下指定即可。它的工作原理与 Vite 插件的 `enforce: 'post'``apply: 'build'` 相同。

guide/build.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050

5151
## 自定义构建 {#customizing-the-build}
5252

53-
构建过程可以通过多种 [构建配置选项](/config/#build-options) 来自定义构建。具体来说,你可以通过 `build.rollupOptions` 直接调整底层的 [Rollup 选项](https://rollupjs.org/configuration-options/)
53+
构建过程可以通过多种 [构建配置选项](/config/#build-options) 来自定义构建。具体来说,你可以通过 `build.rollupOptions` 直接调整底层的 [Rollup 选项](https://cn.rollupjs.org/configuration-options/)
5454

5555
```js [vite.config.js]
5656
export default defineConfig({
5757
build: {
5858
rollupOptions: {
59-
// https://rollupjs.org/configuration-options/
59+
// https://cn.rollupjs.org/configuration-options/
6060
},
6161
},
6262
})
@@ -82,13 +82,13 @@ window.addEventListener('vite:preloadError', (event) => {
8282

8383
## 文件变化时重新构建 {#rebuild-on-files-changes}
8484

85-
你可以使用 `vite build --watch` 来启用 rollup 的监听器。或者,你可以直接通过 `build.watch` 调整底层的 [`WatcherOptions`](https://rollupjs.org/configuration-options/#watch) 选项:
85+
你可以使用 `vite build --watch` 来启用 rollup 的监听器。或者,你可以直接通过 `build.watch` 调整底层的 [`WatcherOptions`](https://cn.rollupjs.org/configuration-options/#watch) 选项:
8686

8787
```js [vite.config.js]
8888
export default defineConfig({
8989
build: {
9090
watch: {
91-
// https://rollupjs.org/configuration-options/#watch
91+
// https://cn.rollupjs.org/configuration-options/#watch
9292
},
9393
},
9494
})
@@ -306,7 +306,7 @@ dist/my-lib.umd.cjs 0.30 kB / gzip: 0.16 kB
306306
:::
307307
308308
::: warning 进阶用法
309-
库模式包括了一种简单而又有见地的配置,适用于面向浏览器和 JS 框架的库。如果你正在构建非面向浏览器的库,或需要高级构建流程,可以直接使用 [Rollup](https://rollupjs.org) 或 [esbuild](https://esbuild.github.io)。
309+
库模式包括了一种简单而又有见地的配置,适用于面向浏览器和 JS 框架的库。如果你正在构建非面向浏览器的库,或需要高级构建流程,可以直接使用 [Rollup](https://cn.rollupjs.org) 或 [esbuild](https://esbuild.github.io)。
310310
:::
311311
312312
## 进阶基础路径选项 {#advanced-base-options}

guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Vite(法语意为 "快速的",发音 `/vit/`<button id="play-vite-audio" onc
1010

1111
- 一个开发服务器,它基于 [原生 ES 模块](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) 提供了 [丰富的内建功能](./features),如速度快到惊人的 [模块热替换(HMR)](./features#hot-module-replacement)
1212

13-
- 一套构建指令,它使用 [Rollup](https://rollupjs.org) 打包你的代码,并且它是预配置的,可输出用于生产环境的高度优化过的静态资源。
13+
- 一套构建指令,它使用 [Rollup](https://cn.rollupjs.org) 打包你的代码,并且它是预配置的,可输出用于生产环境的高度优化过的静态资源。
1414

1515
Vite 是一种具有明确建议的工具,具备合理的默认设置。您可以在 [功能指南](./features) 中了解 Vite 的各种可能性。通过 [插件](./using-plugins),Vite 支持与其他框架或工具的集成。如有需要,您可以通过 [配置部分](../config/) 自定义适应你的项目。
1616

guide/migration-from-v1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ Vite 2 使用了一套完全重定义的,扩展了 Rollup 插件的接口。
120120

121121
一些将 v1 插件迁移到 v2 的提示:
122122

123-
- `resolvers` -> 使用 [`resolveId`](https://rollupjs.org/guide/en/#resolveid) 钩子
124-
- `transforms` -> 使用 [`transform`](https://rollupjs.org/guide/en/#transform) 钩子
123+
- `resolvers` -> 使用 [`resolveId`](https://cn.rollupjs.org/guide/en/#resolveid) 钩子
124+
- `transforms` -> 使用 [`transform`](https://cn.rollupjs.org/guide/en/#transform) 钩子
125125
- `indexHtmlTransforms` -> 使用 [`transformIndexHtml`](./api-plugin#transformindexhtml) 钩子
126-
- 虚拟文件支持 -> 使用 [`resolveId`](https://rollupjs.org/guide/en/#resolveid) + [`load`](https://rollupjs.org/guide/en/#load) 钩子
126+
- 虚拟文件支持 -> 使用 [`resolveId`](https://cn.rollupjs.org/guide/en/#resolveid) + [`load`](https://cn.rollupjs.org/guide/en/#load) 钩子
127127
- 添加 `alias``define` 或其他配置项 -> 使用 [`config`](./api-plugin#config) 钩子
128128

129129
由于大多数逻辑应通过插件钩子实现,而无需使用中间件,因此对中间件的需求大大减少。内部服务器应用现在看起来像旧版的 [connect](https://github.com/senchalabs/connect) 实例,而不是 Koa。

guide/migration-from-v2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Vite v3 默认在 SSR 构建时使用 ESM 格式。当使用 ESM 时,[SSR 外
4545

4646
如果你无法在你的 SSR 项目中使用 ESM,你可以设置 `ssr.format: 'cjs'` 来生成一个 CJS 格式的产物。在这种情况下,会使用和 Vite v2 相同的外部化策略。
4747

48-
同样 [`build.rollupOptions.output.inlineDynamicImports`](https://rollupjs.org/guide/en/#outputinlinedynamicimports) 现在在 `ssr.target``node` 时,也默认置为了 `false``inlineDynamicImports` 它会改变执行顺序,并且 node 构建不需要打包到单个文件。
48+
同样 [`build.rollupOptions.output.inlineDynamicImports`](https://cn.rollupjs.org/guide/en/#outputinlinedynamicimports) 现在在 `ssr.target``node` 时,也默认置为了 `false``inlineDynamicImports` 它会改变执行顺序,并且 node 构建不需要打包到单个文件。
4949

5050
## 其他一般性变化 {#general-changes}
5151

0 commit comments

Comments
 (0)