8

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"

1 Answer 1

11

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Removing react-refresh from the list of plugins fixed it for me. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.