Skip to content

Commit 8223f5d

Browse files
authored
Merge pull request #1315 from vitejs/dev
sync into main
2 parents ba5715b + e8fdff6 commit 8223f5d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

guide/api-environment-frameworks.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ app.use('*', async (req, res, next) => {
103103
})
104104
```
105105
106+
在使用支持 HMR(如 `RunnableDevEnvironment`)的环境时,您应在服务器入口文件中添加 `import.meta.hot.accept()` 以获得最佳性能。若未添加此代码,服务器文件的更改将导致整个服务器模块图失效:
107+
108+
```js
109+
// src/entry-server.js
110+
export function render(...) { ... }
111+
112+
if (import.meta.hot) {
113+
import.meta.hot.accept()
114+
}
115+
```
116+
106117
### `FetchableDevEnvironment`
107118
108119
:::info

0 commit comments

Comments
 (0)