Skip to content

Commit 8ce0078

Browse files
release: v2.4.2
2 parents f94bd91 + dcda7af commit 8ce0078

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

.vitepress/theme/sponsors.json

+6
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@
1616
"name": "Mux",
1717
"href": "https://mux.com",
1818
"src": "/mux.svg"
19+
},
20+
{
21+
"id": "plaid",
22+
"name": "Plaid Inc.",
23+
"href": "https://plaid.co.jp/",
24+
"src": "/plaid.svg"
1925
}
2026
]

blog/announcing-vite2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Vite 1.0 虽然之前进入了 RC 阶段,但在发布之前我们决定进行
2424

2525
设计 Vite 的初衷是为了 [探索黑客原型项目以更好的支持 Vue 单文件组件](https://github.com/vuejs/vue-dev-server)。Vite 1 则是这个想法的延续,并在此基础上增加了对 HMR 支持。
2626

27-
但 2.0 基于之前的经验提供了一个更稳定灵活的内部架构,从而可以完全通过插件机制来支持任意框架。现在 Vite 提供 [官方的 Vue, React, Preact, Lit Element 项目模版](https://github.com/vitejs/vite/tree/main/packages/create-app),而 Svelte 社区也在开发 Vite 整合方案。
27+
但 2.0 基于之前的经验提供了一个更稳定灵活的内部架构,从而可以完全通过插件机制来支持任意框架。现在 Vite 提供 [官方的 Vue, React, Preact, Lit Element 项目模版](https://github.com/vitejs/vite/tree/main/packages/create-vite),而 Svelte 社区也在开发 Vite 整合方案。
2828

2929
### 全新插件机制和 API {#new-plugin-format-and-api}
3030

guide/api-hmr.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ if (import.meta.hot) {
115115
监听自定义 HMR 事件。
116116
117117
以下 HMR 事件由 Vite 自动触发:
118+
118119
- `'vite:beforeUpdate'` 当更新即将被应用时(例如,一个模块将被替换)
119120
- `'vite:beforeFullReload'` 当完整的重载即将发生时
120121
- `'vite:beforePrune'` 当不再需要的模块即将被剔除时
121122
- `'vite:error'` 当发生错误时(例如,语法错误)
122123
123-
自定义 HMR 事件可以由插件发送。更多细节详见 [handleHotUpdate](./api-plugin#handleHotUpdate)。
124+
自定义 HMR 事件可以由插件发送。更多细节详见 [handleHotUpdate](./api-plugin#handleHotUpdate)。

guide/features.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Vite 通过 HTTP 头来缓存请求得到的依赖,所以如果你想要编辑
2424

2525
Vite 提供了一套原生 ESM 的 [HMR API](./api-hmr)。 具有 HMR 功能的框架可以利用该 API 提供即时、准确的更新,而无需重新加载页面或清除应用程序状态。Vite 内置了 HMR 到 [Vue 单文件组件(SFC)](https://github.com/vitejs/vite/tree/main/packages/plugin-vue)[React Fast Refresh](https://github.com/vitejs/vite/tree/main/packages/plugin-react-refresh) 中。也通过 [@prefresh/vite](https://github.com/JoviDeCroock/prefresh/tree/main/packages/vite) 对 Preact 实现了官方集成。
2626

27-
注意,你不需要手动设置这些 —— 当你通过 [`@vitejs/create-app`](./) 创建应用程序时,所选模板已经为你预先配置了这些。
27+
注意,你不需要手动设置这些 —— 当你通过 [`create-vite`](./) 创建应用程序时,所选模板已经为你预先配置了这些。
2828

2929
## TypeScript {#typescript}
3030

guide/index.md

+13-7
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@ Vite 需要 [Node.js](https://nodejs.org/en/) 版本 >= 12.0.0。
2525
使用 NPM:
2626

2727
```bash
28-
$ npm init @vitejs/app
28+
$ npm init vite@latest
2929
```
3030

3131
使用 Yarn:
3232

3333
```bash
34-
$ yarn create @vitejs/app
34+
$ yarn create vite
35+
```
36+
37+
使用 PNPM:
38+
39+
```bash
40+
$ pnpx create-vite
3541
```
3642

3743
然后按照提示操作即可!
@@ -40,13 +46,13 @@ $ yarn create @vitejs/app
4046

4147
```bash
4248
# npm 6.x
43-
npm init @vitejs/app my-vue-app --template vue
49+
npm init vite@latest my-vue-app --template vue
4450

4551
# npm 7+, 需要额外的双横线:
46-
npm init @vitejs/app my-vue-app -- --template vue
52+
npm init vite@latest my-vue-app -- --template vue
4753

4854
# yarn
49-
yarn create @vitejs/app my-vue-app --template vue
55+
yarn create vite my-vue-app --template vue
5056
```
5157

5258
支持的模板预设包括:
@@ -64,11 +70,11 @@ yarn create @vitejs/app my-vue-app --template vue
6470
- `svelte`
6571
- `svelte-ts`
6672

67-
查看 [@vitejs/create-app](https://github.com/vitejs/vite/tree/main/packages/create-app) 获取每个模板的更多细节
73+
查看 [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite) 以获取每个模板的更多细节
6874

6975
## 社区模板 {#community-templates}
7076

71-
@vitejs/create-app 是一个快速生成主流框架基础模板的工具。查看 Awesome Vite 仓库的 [社区维护模板](https://github.com/vitejs/awesome-vite#templates),里面包含各种工具和不同框架的模板。你可以用如 [degit](https://github.com/Rich-Harris/degit) 之类的工具,使用社区模版来搭建项目。
77+
create-vite 是一个快速生成主流框架基础模板的工具。查看 Awesome Vite 仓库的 [社区维护模板](https://github.com/vitejs/awesome-vite#templates),里面包含各种工具和不同框架的模板。你可以用如 [degit](https://github.com/Rich-Harris/degit) 之类的工具,使用社区模版来搭建项目。
7278

7379
```bash
7480
npx degit user/project my-project

public/plaid.svg

+1
Loading

0 commit comments

Comments
 (0)