Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vite and React: stop using "react-refresh"

Tags:

npm

reactjs

vite

Whenever I run npm start in my project I get the following message:

[@vitejs/plugin-react] You should stop using "react-refresh" since this plugin conflicts with it.

Vite seems to work fine regardless, but I was wondering if / how I should disable "react refresh"

like image 274
Sylavn Franklin Avatar asked Jun 19 '26 23:06

Sylavn Franklin


1 Answers

Check your vite.config.js file. Since you are using @vitejs/plugin-react, you should see something like this (plus any other configuration):

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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react({
      babel: {
        plugins: ['babel-plugin-macros', ... (plugins here)],
      },
    }),
  ],
});

In the plugin array, if you have reactRefresh(), this means you are using @vitejs/plugin-react-refresh as well as @vitejs/plugin-react. This is unnecessary since plugin-react has hot refresh built-in and customisable. It probably won't break your code as far as I know but you can safely delete it.

like image 125
DCVDiego Avatar answered Jun 21 '26 13:06

DCVDiego



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!