简体   繁体   中英

React Vite app constantly refreshing (+ docker & traefik)

The app is dockerized and I am using traefik. It constantly reloads (every 3 seconds).

In the console I can see that the error is "Websocket connection to wss://mywebsite.com:3000/ failed".

If it helps, my vite.config.js is simply:

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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
});

Thank you for your help!

I solved it by adding in vite.config.js the following:

server: {
    hmr: { clientPort: 443 },
  },

Hopefully it can help the next one with this issue!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM