I am trying to view my webpage on ipad so I am using the port forwarding. The page opens correctly and even functions but automatically reloads after a few seconds. Here are logs which I get before the reload
WebSocket connection to 'wss://pp3w747r-3001.inc1.devtunnels.ms:3001/' failed:
(anonymous) @ client:188Understand this error
[vite] server connection lost. polling for restart...
Navigated to https://pp3w747r-3001.inc1.devtunnels.ms/
client.ts:16 [vite] connecting...
I have tried many ways. I think this problem is related to vite in someway. I have tried chaning my vite config hmr a lot(disable and other stuff) but nothing worked. Also there is no github issue or anything else related to this issue.
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
dts({
include: [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.d.tsx",
"src/**/*.tsx",
], // Adjust patterns as necessary
exclude: ["node_modules/**", "**/*.spec.ts"], // Exclude unnecessary files
outDir: "dist",
insertTypesEntry: true,
}),
],
server: {
host: "0.0.0.0",
port: 3001,
hmr: false,
watch: { usePolling: false },
},
build: {
lib: {
entry: "src/main.tsx", // Path to your library's entry point
name: "MyLib",
formats: ["es", "umd", "cjs"],
fileName: (format) => `index.${format}.js`,
},
rollupOptions: {
// Externalize dependencies to avoid bundling them into your library
external: ["react", "react-dom"],
output: {
// Provide globals for externalized dependencies
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
});
Here is my vite config. Any help or guidance is appreciated.
Note: I am using windows 10