简体   繁体   English

React Vite app 不断刷新(+ docker & traefik)

[英]React Vite app constantly refreshing (+ docker & traefik)

The app is dockerized and I am using traefik.该应用程序已码头化,我正在使用 traefik。 It constantly reloads (every 3 seconds).它不断重新加载(每 3 秒)。

In the console I can see that the error is "Websocket connection to wss://mywebsite.com:3000/ failed".在控制台中,我可以看到错误是“与 wss://mywebsite.com:3000/ 的 Websocket 连接失败”。

If it helps, my vite.config.js is simply:如果有帮助,我的 vite.config.js 很简单:

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:我通过在 vite.config.js 中添加以下内容来解决它:

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

Hopefully it can help the next one with this issue!希望它可以帮助下一个解决这个问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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