Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

381
Vistas
Function 'each' is undefined antd Vite with React

I´m getting this error in React when importing some components from antd library.

Looks like the error is at: \node_modules\antd\es\input\style\status.less:7:0 (See the picture attached)

Examples of imported components that make the bug show up: Table, Input.

Examples of imported components that have no effect to cause the bug: Col, Row, Progress, Menu, Button...

I created the project using Vite 2.8.6

Libs installed:

"react": "^17.0.2", "less": "2.7.2", "antd": "^4.19.2" "vite-plugin-imp": "^2.1.6"

I noticed that the bug started to happen after I customized the antd theme using the plugin vite-plugin-imp How to change antd theme in Vite config? , and adding some configuration in the vite.config.ts file, I´ll show it below. Before I added the custom theme configuration, it was displaying all the antd components normally (but of course, with the default theme, which I dont want to).

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

export default defineConfig({
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        modifyVars: {
          'primary-color': '#97D700',
          'border-radius-base': '7px',
          'font-family': 'Rubik',
        },
      },
    },
  },
  resolve: {
    alias: [{ find: /^~/, replacement: '' }],
  },
  plugins: [
    react(),
    vitePluginImp({
      libList: [
        {
          libName: 'antd',
          style: (name) => `antd/es/${name}/style`,
        },
      ],
    }),
  ],
});

output of the bug showed in the browser

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Turns out that my less dependency installed was too old "2.7.2", The each() function was added in Less v3.7.0. So I updated it and it worked :)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda