Skip to content

Commit a1e14b4

Browse files
authored
docs: add vite-hmr guide (#796)
1 parent 94e3de9 commit a1e14b4

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

guides/troubleshooting/vite-hmr.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Vite and HMR
3+
description: Learn how to resolve issues with HMR when using Vite.
4+
---
5+
6+
When using Vite and accessing your app via
7+
[dev URLs](../../workspaces/devurls.md), you may encounter issues with hot
8+
module reloading (HMR) not working.
9+
10+
## Why this happens
11+
12+
Vite runs a WebSocket for hot module reloading (HMR) and assumes the client will
13+
listen on a specific port. If this isn't the case, Vite HMR and the client never
14+
connect.
15+
16+
## How to fix
17+
18+
Edit your `vite.config.js` file and add the following information to provide the
19+
appropriate port number:
20+
21+
```js
22+
server: {
23+
hmr: {
24+
clientPort: 443
25+
},
26+
},
27+
```
28+
29+
If this doesn't resolve the issue, please
30+
[contact us](https://coder.com/contact) for further support.

manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@
502502
},
503503
{
504504
"path": "./guides/troubleshooting/502error.md"
505+
},
506+
{
507+
"path": "./guides/troubleshooting/vite-hmr.md"
505508
}
506509
]
507510
}

0 commit comments

Comments
 (0)