Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/server-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,12 @@ export default defineConfig({

用于限制 Vite 开发服务器提供敏感文件的黑名单。这会比 [`server.fs.allow`](#server-fs-allow) 选项的优先级更高。同时还支持 [picomatch 模式](https://github.com/micromatch/picomatch#globbing-features)。

::: tip NOTE

此黑名单不适用于[公共目录](/guide/assets.md#the-public-directory)。公共目录中的所有文件均未经任何过滤,因为它们会在构建过程中直接复制到输出目录。

:::

## server.origin {#server-origin}

- **类型:** `string`
Expand Down
2 changes: 1 addition & 1 deletion guide/api-environment-frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const server = createServer()
const ssrEnvironment = server.environment.ssr
const input = {}

const { createHandler } = await ssrEnvironment.runner.import('./entry.js')
const { createHandler } = await ssrEnvironment.runner.import('./entrypoint.js')
const handler = createHandler(input)
const response = handler(new Request('/'))

Expand Down
16 changes: 16 additions & 0 deletions guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ $ pnpm create vite
$ bun create vite
```

```bash [Deno]
$ deno init --npm vite
```

:::

然后按照提示操作即可!
Expand All @@ -90,6 +94,10 @@ $ pnpm create vite my-vue-app --template vue
$ bun create vite my-vue-app --template vue
```

```bash [Deno]
$ deno init --npm vite my-vue-app --template vue
```

:::

查看 [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite) 以获取每个模板的更多细节:`vanilla`,`vanilla-ts`,`vue`,`vue-ts`,`react`,`react-ts`,`react-swc`,`react-swc-ts`,`preact`,`preact-ts`,`lit`,`lit-ts`,`svelte`,`svelte-ts`,`solid`,`solid-ts`,`qwik`,`qwik-ts`。
Expand Down Expand Up @@ -134,6 +142,10 @@ $ pnpm add -D vite
$ bun add -D vite
```

```bash [Deno]
$ deno add -D npm:vite
```

:::

并创建一个像这样的 `index.html` 文件:
Expand Down Expand Up @@ -162,6 +174,10 @@ $ pnpm vite
$ bunx vite
```

```bash [Deno]
$ deno run -A npm:vite
```

:::

之后就可以在 `http://localhost:5173` 上访问 `index.html`。
Expand Down
6 changes: 3 additions & 3 deletions guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if (import.meta.env.SSR) {

## 设置开发服务器 {#setting-up-the-dev-server}

在构建 SSR 应用程序时,你可能希望完全控制主服务器,并将 Vite 与生产环境脱钩。因此,建议以中间件模式使用 Vite。下面是一个关于 [express](https://expressjs.com/) (v4) 的例子:
在构建 SSR 应用程序时,你可能希望完全控制主服务器,并将 Vite 与生产环境脱钩。因此,建议以中间件模式使用 Vite。下面是一个关于 [express](https://expressjs.com/) 的例子:

```js{15-18} twoslash [server.js]
import fs from 'node:fs'
Expand Down Expand Up @@ -93,7 +93,7 @@ async function createServer() {
// 即使在重新启动后,以下内容仍然有效。
app.use(vite.middlewares)

app.use('*', async (req, res) => {
app.use('*all', async (req, res) => {
// 服务 index.html - 下面我们来处理这个问题
})

Expand All @@ -119,7 +119,7 @@ var app
var vite

// ---cut---
app.use('*', async (req, res, next) => {
app.use('*all', async (req, res, next) => {
const url = req.originalUrl

try {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "CC BY-NC-SA 4.0",
"devDependencies": {
"@shikijs/vitepress-twoslash": "^2.5.0",
"@types/express": "^4.17.21",
"@types/express": "^5.0.1",
"feed": "^4.2.2",
"vitepress": "^1.6.3",
"vitepress-plugin-group-icons": "^1.5.2",
Expand Down
39 changes: 9 additions & 30 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.