Skip to content

Commit 3b9568d

Browse files
authored
docs(en): merge docs-cn/sync-docs into docs-cn/dev @ 0dad951
2 parents 158e3e8 + a383214 commit 3b9568d

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

config/index.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ async function createServer() {
488488
createServer()
489489
```
490490

491-
### server.fsServe.strict {#server-fsserve-strict}
491+
### server.fs.strict {#server-fs-strict}
492492

493493
- **实验性**
494494
- **类型:** `boolean`
@@ -501,7 +501,7 @@ createServer()
501501
- **实验性**
502502
- **类型:** `string`
503503

504-
限制哪些文件可以通过 `/@fs/` 路径提供服务。当 `server.fsServe.strict` 设置为 true 时,访问这个目录外的文件将会返回 403 结果。
504+
限制哪些文件可以通过 `/@fs/` 路径提供服务。当 `server.fsServe.strict` 设置为 true 时,访问这个目录列表外的文件将会返回 403 结果。
505505

506506
Vite 将会搜索此根目录下潜在工作空间并作默认使用。一个有效的工作空间应符合以下几个条件,否则会默认以 [项目 root 目录](/guide/#index-html-and-project-root) 作备选方案。
507507

@@ -514,9 +514,11 @@ createServer()
514514
```js
515515
export default {
516516
server: {
517-
fsServe: {
517+
fs: {
518518
// 可以为项目根目录的上一级提供服务
519-
root: '..'
519+
allow: [
520+
'..'
521+
]
520522
}
521523
}
522524
}
@@ -698,6 +700,10 @@ createServer()
698700

699701
在预构建中强制排除的依赖项。
700702

703+
:::warning CommonJS
704+
CommonJS 的依赖不应该排除在优化外。如果一个 ESM 依赖拥有一个嵌套的 CommonJS 依赖,它也不应被排除。
705+
:::
706+
701707
### optimizeDeps.include {#optimizedeps-include}
702708

703709
- **类型:** `string[]`
@@ -729,7 +735,7 @@ SSR 选项可能会在未来版本中进行调整。
729735

730736
### ssr.noExternal {#ssr-noexternal}
731737

732-
- **类型:** `string[]`
738+
- **类型:** `string | RegExp | (string | RegExp)[]`
733739

734740
列出的是防止被 SSR 外部化依赖项。
735741

guide/api-hmr.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,12 @@ if (import.meta.hot) {
112112
113113
## `hot.on(event, cb)` {#hot-onevent-cb}
114114
115-
监听自定义 HMR 事件。自定义 HMR 事件可以由插件发送。更多细节详见 [handleHotUpdate](./api-plugin#handleHotUpdate)。
115+
监听自定义 HMR 事件。
116+
117+
以下 HMR 事件由 Vite 自动触发:
118+
- `'vite:beforeUpdate'` 当更新即将被应用时(例如,一个模块将被替换)
119+
- `'vite:beforeFullReload'` 当完整的重载即将发生时
120+
- `'vite:beforePrune'` 当不再需要的模块即将被剔除时
121+
- `'vite:error'` 当发生错误时(例如,语法错误)
122+
123+
自定义 HMR 事件可以由插件发送。更多细节详见 [handleHotUpdate](./api-plugin#handleHotUpdate)。

guide/using-plugins.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Falsy 虚值的插件将被忽略,可以用来轻松地启用或停用插件
3333
Vite 旨在为常见的 Web 开发范式提供开箱即用的支持。在寻找一个 Vite 或兼容的 Rollup 插件之前,请先查看 [功能指引](../guide/features.md)。大量在 Rollup 项目中需要使用插件的用例在 Vite 中已经覆盖到了。
3434
:::
3535

36-
查看 [Plugins 章节](../plugins) 获取官方插件信息。社区插件列表请参见 [awesome-vite](https://github.com/vitejs/awesome-vite#plugins)。而对于兼容的 Rollup 插件,请查看 [Vite Rollup 插件](https://vite-rollup-plugins.patak.dev) 获取一个带使用说明的兼容 Rollup 官方插件列表,若列表中没有找到,则请参阅 [Rollup 插件兼容性章节](../guide/api-plugin#rollup-plugin-compatibility)
36+
查看 [Plugins 章节](../plugins/) 获取官方插件信息。社区插件列表请参见 [awesome-vite](https://github.com/vitejs/awesome-vite#plugins)。而对于兼容的 Rollup 插件,请查看 [Vite Rollup 插件](https://vite-rollup-plugins.patak.dev) 获取一个带使用说明的兼容 Rollup 官方插件列表,若列表中没有找到,则请参阅 [Rollup 插件兼容性章节](../guide/api-plugin#rollup-plugin-compatibility)
3737

3838
你也可以使用此 [npm Vite 插件搜索链接](https://www.npmjs.com/search?q=vite-plugin&ranking=popularity) 来找到一些遵循了 [推荐约定](./api-plugin.md#conventions) 的 Vite 插件,或者此 [npm Rollup 插件搜索链接](https://www.npmjs.com/search?q=rollup-plugin&ranking=popularity) 获取 Rollup 插件。
3939

0 commit comments

Comments
 (0)