Skip to content

Configurar react vite para despliegue en netlify

Cambiar vite.config.js a:

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

export default defineConfig({
  plugins: [react()],
  build: {
    rollupOptions: {
      output: {
        manualChunks(id) {
          if (id.includes('node_modules')) {
            return id.toString().split('node_modules/')[1].split('/')[0].toString();
          }
        }
      }
    }
  }
});

Agrega esto a package.json:

  "optionalDependencies": {
    "@rollup/rollup-linux-x64-gnu": "4.6.1"
  }