• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

102
Vistas
Accessing non-existent property of module exports inside circular dependency

i'm having an circular dependency warnings in my node project that caused by index.js file that i wrote to combine some exports, the file look like this: path: utils/index.js.

const mysql = require('./mysqlDB');
const logger = require('./logger');
const ServerError = require('./ServerError');

module.exports = {
    mysql,
    logger,
    ServerError
}

so I can import those in other files like this (lets said its called user.js):

const { logger, mysql, ServerError } = require('../utils');

so now if im requring user.js in another file thats include also things from utils.js im getting the circular dependency warnings and errors after that...

when i deleted the index.js file that I wrote and requried the utils directly int my user.js file the warnings gone. I'm not sure what I do wrong. Thanks.

almost 3 years ago · Juan Pablo Isaza
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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda