Skip to content

Commit df98e18

Browse files
docs(en): merge docs-cn/sync-docs into docs-cn/dev @ 366b04d
2 parents 3b9568d + a29f15d commit df98e18

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

.vitepress/theme/custom.css

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
.release-tag {
4242
font-size: 20px;
4343
font-weight: bold;
44-
font-family: monospace;
4544
display: inline-block;
4645
position: absolute;
4746
top: 50%;

config/index.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ export default async ({ command, mode }) => {
367367

368368
- **类型:** `boolean | string`
369369

370-
在开发服务器启动时自动在浏览器中打开应用程序。当此值为字符串时,会被用作 URL 的路径名。
370+
在开发服务器启动时自动在浏览器中打开应用程序。当此值为字符串时,会被用作 URL 的路径名。若你想指定喜欢的浏览器打开服务器,你可以设置环境变量 `process.env.BROWSER`(例如:`firefox`)。查看 [这个 `open`](https://github.com/sindresorhus/open#app) 获取更多细节。
371371

372372
**示例:**
373373

@@ -516,9 +516,7 @@ createServer()
516516
server: {
517517
fs: {
518518
// 可以为项目根目录的上一级提供服务
519-
allow: [
520-
'..'
521-
]
519+
allow: ['..']
522520
}
523521
}
524522
}
@@ -613,6 +611,12 @@ createServer()
613611

614612
传递给 [@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/master/packages/commonjs) 插件的选项。
615613

614+
### build.dynamicImportVarsOptions {#build-dynamicimportvarsoptions}
615+
616+
- **类型:** [`RollupDynamicImportVarsOptions`](https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#options)
617+
618+
传递给 [@rollup/plugin-dynamic-import-vars](https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars) 的选项。
619+
616620
### build.lib {#build-lib}
617621

618622
- **类型:** `{ entry: string, name?: string, formats?: ('es' | 'cjs' | 'umd' | 'iife')[], fileName?: string }`

guide/env-and-mode.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Vite 在一个特殊的 **`import.meta.env`** 对象上暴露环境变量。这
66

77
- **`import.meta.env.MODE`**: {string} 应用运行的[模式](#模式)
88

9-
- **`import.meta.env.BASE_URL`**: {string} 部署应用时的基本URL。他由[`base` 配置项](/config/#base)决定。
9+
- **`import.meta.env.BASE_URL`**: {string} 部署应用时的基本 URL。他由[`base` 配置项](/config/#base)决定。
1010

1111
- **`import.meta.env.PROD`**: {boolean} 应用是否运行在生产环境。
1212

@@ -24,7 +24,7 @@ Vite 在一个特殊的 **`import.meta.env`** 对象上暴露环境变量。这
2424

2525
## `.env` 文件 {#env-files}
2626

27-
Vite 使用 [dotenv](https://github.com/motdotla/dotenv) 从你的 [环境目录](/config/#envDir) 中的下列文件加载额外的环境变量:
27+
Vite 使用 [dotenv](https://github.com/motdotla/dotenv) 从你的 [环境目录](/config/#envdir) 中的下列文件加载额外的环境变量:
2828

2929
```
3030
.env # 所有情况下都会加载
@@ -46,14 +46,14 @@ VITE_SOME_KEY=123
4646

4747
:::warning 安全注意事项
4848

49-
- `.env.*.local` 文件应是本地的,可以包含敏感变量。你应该将 `.local` 添加到你的 `.gitignore` 中,以避免它们被git检入
49+
- `.env.*.local` 文件应是本地的,可以包含敏感变量。你应该将 `.local` 添加到你的 `.gitignore` 中,以避免它们被 git 检入
5050

5151
- 由于任何暴露给 Vite 源码的变量最终都将出现在客户端包中,`VITE_*` 变量应该不包含任何敏感信息。
5252
:::
5353

5454
### 智能提示 {#intellisense}
5555

56-
默认情况下,Vite为 `import.meta.env` 提供了类型定义。随着在 `.env[mode]` 文件中自定义了越来越多的环境变量,你可能想要在代码中获取这些以 `VITE_` 为前缀的用户自定义环境变量的 TypeScript 智能提示。
56+
默认情况下,Vite 为 `import.meta.env` 提供了类型定义。随着在 `.env[mode]` 文件中自定义了越来越多的环境变量,你可能想要在代码中获取这些以 `VITE_` 为前缀的用户自定义环境变量的 TypeScript 智能提示。
5757

5858
要想做到这一点,你可以在 `src` 目录下创建一个 `env.d.ts` 文件,接着按下面这样增加 `ImportMetaEnv` 的定义:
5959

0 commit comments

Comments
 (0)