Run this line in the terminal of your IDE

npm install -D less

Make sure this text is in your vite.config.js file

// <https://vite.dev/config/>
export default defineConfig({
  plugins: [react()],
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
});