https://github.com/edivados/vite-plugin-github-codespace-hmr
Vite plugin to make hmr work in GitHub Codepsaces.
https://github.com/edivados/vite-plugin-github-codespace-hmr
codespace codespaces github-codespace github-codespaces hmr plugin vite vite-plugin vitejs vitejs-plugin
Last synced: 10 months ago
JSON representation
Vite plugin to make hmr work in GitHub Codepsaces.
- Host: GitHub
- URL: https://github.com/edivados/vite-plugin-github-codespace-hmr
- Owner: edivados
- License: mit
- Created: 2024-06-30T17:36:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-22T17:11:35.000Z (about 1 year ago)
- Last Synced: 2024-12-30T00:33:06.023Z (12 months ago)
- Topics: codespace, codespaces, github-codespace, github-codespaces, hmr, plugin, vite, vite-plugin, vitejs, vitejs-plugin
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vite Plugin GitHub Codespace HMR
Vite plugin to set the correct HMR client hostname in GitHub Codespaces when the HMR client port differs from the server port.
> [!NOTE]
> While this plugin sets the correct client hostname in Vite's client script, you may need to open the address of the forwaded HMR port in your browser once for it to work. When the server and HMR address are the same, this step is unnecessary because you are likely opening the address to view your app.
Reference: https://github.com/vitejs/vite/issues/8666#issuecomment-1315694497
## Installation
```
npm install @edivados/vite-plugin-github-codespace-hmr
```
## Usage
```js
import { defineConfig } from "vite";
import codespaceHMR from "@edivados/vite-plugin-github-codespace-hmr";
export default defineConfig({
server: {
hmr: {
port: 4040
}
},
plugins: [codespaceHMR()]
});
```
## Options
### options
- Type: Object
- Default: {}
#### options.open
- Type: boolean
- Default: false
Indicates whether the plugin should open the HMR address.
#### options.openTimeout
- Type: number
- Default: 2000
The timeout duration (in milliseconds) before the HMR address is opened.