Skip to content

Commit ce373ba

Browse files
committed
docs(cn): resolve conflicts
1 parent 05dadfc commit ce373ba

File tree

5 files changed

+34
-131
lines changed

5 files changed

+34
-131
lines changed

.vitepress/config.ts

+5-39
Original file line numberDiff line numberDiff line change
@@ -307,44 +307,28 @@ export default defineConfig({
307307
sidebar: {
308308
'/guide/': [
309309
{
310-
<<<<<<< HEAD
311-
text: '指引',
310+
text: '介绍',
312311
items: [
313-
{
314-
text: '为什么选 Vite',
315-
link: '/guide/why'
316-
},
317312
{
318313
text: '开始',
319-
link: '/guide/'
320-
},
321-
{
322-
text: '功能',
323-
link: '/guide/features'
324-
=======
325-
text: 'Introduction',
326-
items: [
327-
{
328-
text: 'Getting Started',
329314
link: '/guide/',
330315
},
331316
{
332-
text: 'Philosophy',
317+
text: '理念',
333318
link: '/guide/philosophy',
334319
},
335320
{
336-
text: 'Why Vite',
321+
text: '为什么选 Vite',
337322
link: '/guide/why',
338323
},
339324
],
340325
},
341326
{
342-
text: 'Guide',
327+
text: '指引',
343328
items: [
344329
{
345-
text: 'Features',
330+
text: '功能',
346331
link: '/guide/features',
347-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
348332
},
349333
{
350334
text: '命令行接口',
@@ -383,34 +367,16 @@ export default defineConfig({
383367
link: '/guide/backend-integration'
384368
},
385369
{
386-
<<<<<<< HEAD
387-
text: '比较',
388-
link: '/guide/comparisons'
389-
},
390-
{
391370
text: '故障排除',
392-
link: '/guide/troubleshooting'
393-
=======
394-
text: 'Troubleshooting',
395371
link: '/guide/troubleshooting',
396-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
397372
},
398373
{
399374
text: '性能',
400375
link: '/guide/performance',
401376
},
402377
{
403-
<<<<<<< HEAD
404-
text: '理念',
405-
link: '/guide/philosophy',
406-
},
407-
{
408378
text: '从 v5 迁移',
409379
link: '/guide/migration'
410-
=======
411-
text: 'Migration from v5',
412-
link: '/guide/migration',
413-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
414380
},
415381
{
416382
text: '破坏性变更',

blog/announcing-vite2.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ Vite(法语意思是 “快”,发音为 `/vit/`,类似 veet)是一种
3333

3434
想知道 Vite 有多快?看看这个[视频比较](https://twitter.com/amasad/status/1355379680275128321), 在 Repl.it 上从零启动一个基于 Vite 的 React 应用,浏览器页面加载完毕的时候,基于 CRA(`create-react-app`)的应用甚至还没有安装完依赖。
3535

36-
<<<<<<< HEAD
37-
如果你还没听说过 Vite 到底是什么,可以到 [这里](/guide/why) 了解一下项目的设计初衷。如果你想要了解 Vite 跟其它一些类似的工具有什么区别,可以参考这里的 [对比](/guide/comparisons)
38-
=======
39-
If you've never heard of Vite before and would love to learn more about it, check out [the rationale behind the project](https://vite.dev/guide/why.html). If you are interested in how Vite differs from other similar tools, check out the [comparisons](https://v5.vite.dev/guide/comparisons.html).
40-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
36+
如果你还没听说过 Vite 到底是什么,可以到 [这里](/guide/why) 了解一下项目的设计初衷。如果你想要了解 Vite 跟其它一些类似的工具有什么区别,可以参考这里的 [对比](https://v5.vite.dev/guide/comparisons.html)
4137

4238
## 2.0 带来了什么 {#whats-new-in-2-0}
4339

guide/features.md

+18-63
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,12 @@ export type { T }
7171

7272
- [TypeScript 文档](https://www.typescriptlang.org/tsconfig#useDefineForClassFields)
7373

74-
<<<<<<< HEAD
75-
从 Vite v2.5.0 开始,如果 TypeScript 的 target 是 `ESNext``ES2022` 及更新版本,此选项默认值则为 `true`。这与 [`tsc` v4.3.2 及以后版本的行为](https://github.com/microsoft/TypeScript/pull/42663) 一致。这也是标准的 ECMAScript 的运行时行为。
74+
如果 TypeScript 的 target 是 `ES2022` 或更高版本,包括 `ESNext`,那么默认值将为 `true`。这与 [TypeScript 4.3.2 及以后版本的行为](https://github.com/microsoft/TypeScript/pull/42663) 保持一致。
7675

7776
若设了其他 TypeScript target,则本项会默认为 `false`.
7877

79-
但对于那些习惯其他编程语言或旧版本 TypeScript 的开发者来说,这可能是违反直觉的。
80-
你可以参阅 [TypeScript 3.7 发布日志](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier) 中了解更多关于如何兼容的信息。
81-
8278
如果你正在使用一个严重依赖 class fields 的库,请注意该库对此选项的预期设置。
83-
84-
大多数库都希望 `"useDefineForClassFields": true`,如 [MobX](https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties)
85-
86-
但是有几个库还没有兼容这个新的默认值,其中包括 [`lit-element`](https://github.com/lit/lit-element/issues/1030)。如果遇到这种情况,请将 `useDefineForClassFields` 设置为 `false`
87-
=======
88-
The default value will be `true` if the TypeScript target is `ES2022` or newer including `ESNext`. It is consistent with the [behavior of TypeScript 4.3.2+](https://github.com/microsoft/TypeScript/pull/42663).
89-
Other TypeScript targets will default to `false`.
90-
91-
`true` is the standard ECMAScript runtime behavior.
92-
93-
If you are using a library that heavily relies on class fields, please be careful about the library's intended usage of it.
94-
While most libraries expect `"useDefineForClassFields": true`, you can explicitly set `useDefineForClassFields` to `false` if your library doesn't support it.
95-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
79+
虽然大多数库期望 `"useDefineForClassFields": true`,但如果你的库不支持它,你可以明确地将 `useDefineForClassFields` 设置为 `false`
9680

9781
#### `target` {#target}
9882

@@ -134,13 +118,9 @@ Vite 默认的类型定义是写给它的 Node.js API 的。要将其补充到
134118
/// <reference types="vite/client" />
135119
```
136120

137-
<<<<<<< HEAD
138-
或者,你也可以将 `vite/client` 添加到 `tsconfig.json` 中的 `compilerOptions.types` 下:
139-
=======
140-
::: details Using `compilerOptions.types`
121+
::: details 使用 `compilerOptions.types`
141122

142-
Alternatively, you can add `vite/client` to `compilerOptions.types` inside `tsconfig.json`:
143-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
123+
或者,你也可以将 `vite/client` 添加到 `tsconfig.json` 中的 `compilerOptions.types` 下:
144124

145125
```json [tsconfig.json]
146126
{
@@ -150,23 +130,15 @@ Alternatively, you can add `vite/client` to `compilerOptions.types` inside `tsco
150130
}
151131
```
152132

153-
<<<<<<< HEAD
154-
这将会提供以下类型定义补充:
155-
156-
- 资源导入 (例如:导入一个 `.svg` 文件)
157-
- `import.meta.env` 上 Vite 注入的 [常量变量](./env-and-mode#env-variables) 的类型定义
158-
- `import.meta.hot` 上的 [HMR API](./api-hmr) 类型定义
159-
=======
160-
Note that if [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types) is specified, only these packages will be included in the global scope (instead of all visible ”@types” packages).
133+
需要注意的是,如果指定了 [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types),则只有这些包会被包含在全局作用域内(而不是所有的“@types”包)。
161134

162135
:::
163136

164-
`vite/client` provides the following type shims:
137+
`vite/client` 会提供以下类型定义补充:
165138

166-
- Asset imports (e.g. importing an `.svg` file)
167-
- Types for the Vite-injected [constants](./env-and-mode#env-variables) on `import.meta.env`
168-
- Types for the [HMR API](./api-hmr) on `import.meta.hot`
169-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
139+
- 资源导入 (例如:导入一个 `.svg` 文件)
140+
- `import.meta.env` 上 Vite 注入的 [常量](./env-and-mode#env-variables) 的类型定义
141+
- `import.meta.hot` 上的 [HMR API](./api-hmr) 类型定义
170142

171143
::: tip
172144
要覆盖默认的类型定义,请添加一个包含你所定义类型的文件,请在三斜线注释 reference `vite/client` 前添加定义。
@@ -232,41 +204,24 @@ HTML 文件位于 Vite 项目的[最前端和中心](/guide/#index-html-and-proj
232204

233205
要退出对某些元素的 HTML 处理,可以在元素上添加 `vite-ignore` 属性,这在引用外部 assets 或 CDN 时非常有用。
234206

235-
<<<<<<< HEAD
236-
## Vue {#vue}
207+
## 框架支持 {#frameworks}
237208

238-
Vite Vue 提供第一优先级支持:
209+
所有现代框架都已和 Vite 集成。大多数框架插件由各自的框架团队维护,唯有官方的 Vue 和 React Vite 插件由 Vite 组织维护。
239210

240-
- Vue 3 单文件组件支持:[@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue)
241-
- Vue 3 JSX 支持:[@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
242-
- Vue 2.7 SFC 支持:[@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2)
243-
- Vue 2.7 JSX 支持:[@vitejs/plugin-vue2-jsx](https://github.com/vitejs/vite-plugin-vue2-jsx)
244-
=======
245-
## Frameworks
211+
- Vue 支持:[@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue)
212+
- Vue JSX 支持:[@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
213+
- React 支持:[@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react)
214+
- React 使用 SWC 的支持:[@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc)
246215

247-
All modern frameworks maintain integrations with Vite. Most framework plugins are maintained by each framework team, with the exception of the official Vue and React Vite plugins that are maintained in the vite org:
248-
249-
- Vue support via [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue)
250-
- Vue JSX support via [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
251-
- React support via [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react)
252-
- React using SWC support via [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc)
253-
254-
Check out the [Plugins Guide](https://vite.dev/plugins) for more information.
255-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
216+
查看 [插件指南](/plugins) 了解更多信息。
256217

257218
## JSX {#jsx}
258219

259220
`.jsx``.tsx` 文件同样开箱即用。JSX 的转译同样是通过 [esbuild](https://esbuild.github.io)
260221

261-
<<<<<<< HEAD
262-
Vue 用户应使用官方提供的 [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) 插件,它提供了 Vue 3 特性的支持,包括 HMR,全局组件解析,指令和插槽。
263-
264-
如果不是在 React 或 Vue 中使用 JSX,自定义的 `jsxFactory``jsxFragment` 可以使用 [`esbuild` 选项](/config/shared-options.md#esbuild) 进行配置。例如对 Preact:
265-
=======
266-
Your framework of choice will already configure JSX out of the box (for example, Vue users should use the official [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) plugin, which provides Vue 3 specific features including HMR, global component resolving, directives and slots).
222+
你选择的框架已经可以开箱即用地配置 JSX(例如,Vue 用户应使用官方的 [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) 插件,它提供了 Vue 3 特定的功能,包括 HMR,全局组件解析,指令和插槽)。
267223

268-
If using JSX with your own framework, custom `jsxFactory` and `jsxFragment` can be configured using the [`esbuild` option](/config/shared-options.md#esbuild). For example, the Preact plugin would use:
269-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
224+
如果你使用自己的框架运行 JSX,可以使用 [`esbuild` 选项](/config/shared-options.md#esbuild) 来配置自定义的 `jsxFactory``jsxFragment`。例如,Preact 插件会使用:
270225

271226
```js twoslash [vite.config.js]
272227
import { defineConfig } from 'vite'

guide/index.md

+6-14
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,7 @@ Vite 也支持多个 `.html` 作入口点的 [多页面应用模式](./build#mul
202202

203203
## 使用未发布的功能 {#using-unreleased-commits}
204204

205-
<<<<<<< HEAD
206-
如果你迫不及待想要体验最新的功能,可以自行克隆 [vite 仓库](https://github.com/vitejs/vite) 到本地机器上然后自行将其链接(将需要 [pnpm](https://pnpm.io/)):
207-
=======
208-
If you can't wait for a new release to test the latest features, you can install a specific commit of Vite with https://pkg.pr.new:
205+
如果你迫不及待想要体验最新的功能,可以使用 https://pkg.pr.new 安装特定的 Vite 提交:
209206

210207
::: code-group
211208

@@ -227,10 +224,9 @@ $ bun add -D https://pkg.pr.new/vite@SHA
227224

228225
:::
229226

230-
Replace `SHA` with any of [Vite's commit SHAs](https://github.com/vitejs/vite/commits/main/). Note that only commits within the last month will work, as older commit releases are purged.
227+
`SHA` 替换为 [Vite 的提交 SHA](https://github.com/vitejs/vite/commits/main/)。请注意,仅最近一个月的提交有效,旧版本提交的构建产物会被清除。
231228

232-
Alternatively, you can also clone the [vite repo](https://github.com/vitejs/vite) to your local machine and then build and link it yourself ([pnpm](https://pnpm.io/) is required):
233-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
229+
或者,你可以克隆 [Vite 代码仓库](https://github.com/vitejs/vite) 到本地,自行构建并建立软链接(需安装 [pnpm](https://pnpm.io/)):
234230

235231
```bash
236232
git clone https://github.com/vitejs/vite.git
@@ -243,14 +239,10 @@ pnpm link --global # 在这一步中可使用你喜欢的包管理器
243239

244240
然后,回到你的 Vite 项目并运行 `pnpm link --global vite`(或者使用你的其他包管理工具来全局链接 `vite`)。重新启动开发服务器来体验新功能吧!
245241

246-
<<<<<<< HEAD
247-
## 社区 {#community}
248-
=======
249-
::: tip Dependencies using Vite
250-
To replace the Vite version used by dependencies transitively, you should use [npm overrides](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#overrides) or [pnpm overrides](https://pnpm.io/package_json#pnpmoverrides).
242+
::: tip 处理依赖中的 Vite 版本
243+
若需替换依赖链中传递使用的 Vite 版本(Transitive Dependencies),应使用 [npm overrides](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#overrides)[pnpm overrides](https://pnpm.io/package_json#pnpmoverrides)
251244
:::
252245

253-
## Community
254-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
246+
## 社区 {#community}
255247

256248
如果你有疑问或者需要帮助,可以到 [Discord](https://chat.vite.dev)[GitHub Discussions](https://github.com/vitejs/vite/discussions) 社区来寻求帮助。

guide/why.md

+4-10
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,10 @@ Vite 目前的插件 API 与使用 `esbuild` 作为打包器并不兼容。尽
5757

5858
Rollup 已经开始着手改进性能,[在 v4 中将其解析器切换到 SWC](https://github.com/rollup/rollup/pull/5073)。同时还有一个正在进行中的工作,即构建一个名为 Rolldown 的 Rust 版本的 Rollup。一旦 Rolldown 准备就绪,它就可以在 Vite 中取代 Rollup 和 esbuild,显著提高构建性能,并消除开发和构建之间的不一致性。你可以观看 [Evan You 在 ViteConf 2023 的主题演讲](https://youtu.be/hrdwQHoAp0M) 了解更多细节。
5959

60-
<<<<<<< HEAD
61-
## Vite 与 X 的区别是? {#how-is-vite-different-from-x}
60+
## Vite 与其他免打包构建工具的关系是什么?{##how-vite-relates-to-other-unbundled-build-tools}
6261

63-
你可以查看 [比较](./comparisons.md) 章节获取更多细节,了解 Vite 与同类工具的异同。
64-
=======
65-
## How Vite Relates to Other Unbundled Build Tools?
62+
Preact 团队的 [WMR](https://github.com/preactjs/wmr) 旨在提供类似的功能集。Vite 用于开发和构建的通用 Rollup 插件 API 就是受其启发。WMR 已经不再维护。Preact 团队现在推荐使用 Vite 和 [@preactjs/preset-vite](https://github.com/preactjs/preset-vite)
6663

67-
[WMR](https://github.com/preactjs/wmr) by the Preact team looked to provide a similar feature set. Vite's universal Rollup plugin API for dev and build was inspired by it. WMR is no longer maintained. The Preact team now recommends Vite with [@preactjs/preset-vite](https://github.com/preactjs/preset-vite).
64+
[Snowpack](https://www.snowpack.dev/) 也是一个免打包的原生 ESM 开发服务器,与 Vite 的职责非常相似。Vite 的依赖预打包也受到了 Snowpack v1(现在是 [`esinstall`](https://github.com/snowpackjs/snowpack/tree/main/esinstall))的启发。Snowpack 已经不再维护。Snowpack 团队现在正在研究由 Vite 驱动的静态网站构建器 [Astro](https://astro.build/)
6865

69-
[Snowpack](https://www.snowpack.dev/) was also a no-bundle native ESM dev server, very similar in scope to Vite. Vite's dependency pre-bundling is also inspired by Snowpack v1 (now [`esinstall`](https://github.com/snowpackjs/snowpack/tree/main/esinstall)). Snowpack is no longer being maintained. The Snowpack team is now working on [Astro](https://astro.build/), a static site builder powered by Vite.
70-
71-
[@web/dev-server](https://modern-web.dev/docs/dev-server/overview/) (previously `es-dev-server`) is a great project and Vite 1.0's Koa-based server setup was inspired by it. The `@web` umbrella project is actively maintained and contains many other excellent tools that may benefit Vite users as well.
72-
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
66+
[@web/dev-server](https://modern-web.dev/docs/dev-server/overview/)(以前是 `es-dev-server`)是一个伟大的项目,Vite 1.0 的基于 Koa 的服务器设置就是受其启发。`@web` 这个项目正在积极维护,并包含许多其他优秀的工具,这些工具也可能对 Vite 用户有所帮助。

0 commit comments

Comments
 (0)