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.