Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6052

Hot module replacement not working in Vite + React + Ts using Ubuntu via WSL

$
0
0

I have an issue with not re-rendering page automatically after saving a file (after I made changes). Fsr, it works in Powershell, which is very weird. This is my package.json file if that is needed:

{"name": "vite-project","private": true,"version": "0.0.0","type": "module","main": "dist/index.js","scripts": {"dev": "vite","build": "tsc && vite build","lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0","preview": "vite preview","test": "tsc && jest"  },"dependencies": {"react": "^18.2.0","react-dom": "^18.2.0"  },"devDependencies": {"@babel/preset-typescript": "^7.24.1","@types/jest": "^29.5.12","@types/react": "^18.2.66","@types/react-dom": "^18.2.22","@typescript-eslint/eslint-plugin": "^7.2.0","@typescript-eslint/parser": "^7.2.0","@vitejs/plugin-react": "^4.2.1","autoprefixer": "^10.4.19","eslint": "^8.57.0","eslint-plugin-react-hooks": "^4.6.0","eslint-plugin-react-refresh": "^0.4.6","jest": "^29.7.0","postcss": "^8.4.38","tailwindcss": "^3.4.1","ts-jest": "^29.1.2","typescript": "^5.2.2","vite": "^5.2.0"  }}

and vite.config.js file:

import { defineConfig } from 'vite'import react from '@vitejs/plugin-react'// https://vitejs.dev/config/export default defineConfig({  plugins: [react()],})

Note: In Ubuntu it renders after I hit r+enter, which reset server.

So I tried several approaches:
• update Ubuntu
• deleting node_modules and package-lock.json and installing all dependencies again
• use different node versions (16.3.0, 18.12.0, 2012.2), btw in Powershell it works with 18.12.0 version
• and different npm versions
• in https://vitejs.dev/guide/troubleshooting in section Dev Server: Requests are stalled forever I tried to increase file descriptor limit and increase the following inotify related limits
• deleting whole project and re-clone my project again

I wonder why it stopped working. It worked before wonderfully...Thanks a lot for any help :)


Viewing all articles
Browse latest Browse all 6052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>