Skip to content

Commit

Permalink
release: v2.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
QC-L committed Jun 2, 2021
2 parents 1b53726 + d530b18 commit 8307fde
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .vitepress/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
},
[h('span', 'Sponsors')]
),
...sponsors.map(({ href, src, name }) =>
...sponsors.map(({ href, src, name, id }) =>
h(
'a',
{
Expand All @@ -28,7 +28,7 @@ export default {
rel: 'noopener',
'aria-label': 'sponsor-img'
},
[h('img', { src, alt: name })]
[h('img', { src, alt: name, id: `sponsor-${id}` })]
)
)
])
Expand Down
9 changes: 7 additions & 2 deletions .vitepress/theme/sponsors.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

.sponsors img {
max-width: 200px;
max-height: 40px;
height: 40px;
display: block;
margin: 1.25rem 0;
}
Expand All @@ -28,4 +28,9 @@
color: #999;
font-size: 1.2rem;
border: none;
}
}

/* special cases */
#sponsor-mux {
padding: 5px 0;
}
8 changes: 8 additions & 0 deletions .vitepress/theme/sponsors.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
[
{
"id": "tailwind",
"name": "Tailwind Labs",
"href": "https://tailwindcss.com",
"src": "/tailwind-labs.svg"
},
{
"id": "vuejobs",
"name": "Vue Jobs",
"href": "https://vuejobs.com/?ref=vuejs",
"src": "/vuejobs.png"
},
{
"id": "mux",
"name": "Mux",
"href": "https://mux.com",
"src": "/mux.svg"
}
]
16 changes: 15 additions & 1 deletion config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ export default async ({ command, mode }) => {

设为 `false` 可以避免 Vite 清屏而错过在终端中打印某些关键信息。命令行模式下可以通过 `--clearScreen false` 设置。

### envDir

- **类型:** `string`
- **默认:** `root`

用于加载 `.env` 文件的目录。可以是一个绝对路径,也可以是相对于项目根的路径。

关于环境文件的更多信息,请参见 [这里](/guide/env-and-mode#env-files)

## 开发服务器选项 {#server-options}

### server.host {#server-host}
Expand Down Expand Up @@ -418,12 +427,17 @@ export default async ({ command, mode }) => {

### server.hmr {#server-hmr}

- **类型:** `boolean | { protocol?: string, host?: string, port?: number, path?: string, timeout?: number, overlay?: boolean }`
- **类型:** `boolean | { protocol?: string, host?: string, port?: number, path?: string, timeout?: number, overlay?: boolean, clientPort?: number, server?: Server }`

禁用或配置 HMR 连接(用于 HMR websocket 必须使用不同的 http 服务器地址的情况)。

设置 `server.hmr.overlay``false` 可以禁用开发服务器错误的屏蔽。

`clientPort` 是一个高级选项,只在客户端的情况下覆盖端口,这允许你为 websocket 提供不同的端口,而并非在客户端代码中查找。如果需要在 dev-server 情况下使用 SSL 代理,这非常有用。

当使用 `server.middlewareMode``server.https` 时,你需将 `server.hmr.server` 设置为你 HTTPS 的服务器,这将通过你的服务器来处理 HMR 的安全连接请求。这在使用自签证书的情况下,非常有用。


### server.watch {#server-watch}

- **类型:** `object`
Expand Down
8 changes: 7 additions & 1 deletion guide/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,20 @@ import shaderString from './shader.glsl?raw'

### 导入脚本作为 Worker {#importing-script-as-a-worker}

脚本可以通过 `?worker` 后缀导入为 web worker。
脚本可以通过 `?worker` `?sharedworker` 后缀导入为 web worker。

```js
// 在生产构建中将会分离出 chunk
import Worker from './shader.js?worker'
const worker = new Worker()
```

```js
// sharedworker
import SharedWorker from './shader.js?sharedworker'
const sharedWorker = new SharedWorker()
```

```js
// 内联为 base64 字符串
import InlineWorker from './shader.js?worker&inline'
Expand Down
4 changes: 2 additions & 2 deletions guide/env-and-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Vite 在一个特殊的 **`import.meta.env`** 对象上暴露环境变量。这

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

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

```
.env # 所有情况下都会加载
Expand Down Expand Up @@ -93,4 +93,4 @@ NODE_ENV=production
VITE_APP_TITLE=My App (staging)
```

现在,你的 staging 应用应该具有类似于生产的行为,但显示的标题与生产环境不同。
现在,你的 staging 应用应该具有类似于生产的行为,但显示的标题与生产环境不同。
2 changes: 1 addition & 1 deletion guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ init({

## Web Worker {#web-workers}

一个 web worker 脚本可以直接通过添加一个 `?worker` 查询参数来导入。默认导出一个自定义的 worker 构造器:
一个 web worker 脚本可以直接通过添加一个 `?worker` `?sharedworker` 查询参数来导入。默认导出一个自定义的 worker 构造器:

```js
import MyWorker from './worker?worker'
Expand Down
2 changes: 1 addition & 1 deletion guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SSR 特别指支持在 Node.js 中运行相同应用程序的前端框架(例
:::

:::warning Low-level API
This is a low-level API meant for library and framework authors. If your goal is to create an application, make sure to check out the higher-level SSR plugins and tools at [Awesome Vite SSR section](https://github.com/vitejs/awesome-vite#ssr) first. That said, many applications are successfully built directly on top of Vite's native low-level API.
这是一个底层 API,是为库和框架作者准备的。如果你的目标是构建一个应用程序,请确保优先查看 [Vite SSR 章节](https://github.com/vitejs/awesome-vite#ssr) 中更上层的 SSR 插件和工具。也就是说,大部分应用都是基于 Vite 的底层 API 之上构建的。
:::

:::tip 帮助
Expand Down
16 changes: 15 additions & 1 deletion guide/static-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,18 @@ $ npm run preview

在项目被导入之后,所有后续的推送都将生成预览部署,但只有对生产分支(通常是 “main”)所做的更改才会触发生产部署。

一旦部署,你会得到一个实时查看应用的 URL,如 https://vite.vercel.app 。
一旦部署,你会得到一个实时查看应用的 URL,如 https://vite.vercel.app。

## Azure 的静态网站应用 {#azure-static-web-apps}

你可以通过微软 Azure 的 [静态网站应用](https://aka.ms/staticwebapps) 服务来快速部署你的 Vite 应用。你只需:

- 注册 Azure 账号并获取一个订阅(subscription)的 key。可以在 [此处快速完成注册](https://azure.microsoft.com/free)。
- 将你的应用代码托管到 [GitHub](https://github.com)。
- 在 [VSCode](https://code.visualstudio.com) 中安装 [SWA 扩展](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps)。

安装完此扩展后,进入你应用的根目录。打开 SWA 的扩展程序,登录 Azure,并点击 '+',来创建一个全新的 SWA。系统会提示你指定所需的订阅 key。

按照扩展程序的启动向导,给你的应用程序起个名字,选择框架预设,并指定应用程序的根目录(通常为 `/`)以及构建文件的路径 `/dist`。此向导完成后,会在你的 repo 中的 `.github` 文件夹中创建一个 Github Action。

这个 action 致力于部署你的应用程序(可以在仓库的 Actions 标签中,查看相关进度),成功完成后,你可以点击 Github 中出现的 “浏览站点” 的按钮,查看你的应用程序。
4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ footer: MIT Licensed | Copyright © 2019-present Evan You & Vite Contributors

<div class="frontpage sponsors">
<h2>赞助</h2>
<a v-for="{ href, src, name } of sponsors" :href="href" target="_blank" rel="noopener" aria-label="sponsor-img">
<img :src="src" :alt="name">
<a v-for="{ href, src, name, id } of sponsors" :href="href" target="_blank" rel="noopener" aria-label="sponsor-img">
<img :src="src" :alt="name" :id="`sponsor-${id}`">
</a>
<br>
<a href="https://github.com/sponsors/yyx990803" target="_blank" rel="noopener">在 GitHub 上赞助我们</a>
Expand Down
79 changes: 79 additions & 0 deletions public/mux.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8307fde

Please sign in to comment.