Page hot-update by Vite when send axios request and using @tailwindcss/vite plugin
03:50 04 Mar 2025

I have a project that uses Axios for data fetching. However, I noticed something strange:

  • When I fetch data by clicking a button and my vite.config.js file contains tailwind() (@tailwindcss/vite plugin) in plugins, the browser refreshes automatically.

  • When I remove the tailwind() (@tailwindcss/vite plugin) statements plugins, the fetch request works as expected without refreshing the page.

I've already tried using event.preventDefault(), but it didn't solve the issue.

Why does this happen, and how can I prevent the browser from refreshing while keeping Tailwind imported?

Any insights would be greatly appreciated!

reactjs axios tailwind-css vite tailwind-css-4