Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrading to Vite 5 (and @vitejs/plugin-react, typescript) #3845

Open
tyange opened this issue Oct 21, 2024 · 0 comments
Open

upgrading to Vite 5 (and @vitejs/plugin-react, typescript) #3845

tyange opened this issue Oct 21, 2024 · 0 comments
Labels
Enhancement New feature or request

Comments

@tyange
Copy link

tyange commented Oct 21, 2024

Is your feature request related to a problem? Please describe.

After upgrading to Vite 5 in a Wails project, the WebSocket connection for Hot Module Replacement (HMR) fails.

Describe the solution you'd like

Update the 'react-ts' template provided by Wails to include the necessary Vite configuration for WebSocket connections. Or, modify Wails internal WebSocket server configuration to be compatible with any Vite version.

Describe alternatives you've considered

manually configuring the HMR settings in the Vite configuration file.

vite.config.ts in 'frontend' directory should be:

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    hmr: {
      host: "localhost",
      protocol: "ws",
    },
  },
});

It works well in:

"@vitejs/plugin-react": "^4.3.3",
"typescript": "^5.6.3",
"vite": "^5.4.9"

Additional context

No response

@tyange tyange added the Enhancement New feature or request label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant