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

154
Vistas
Problems with circular imports using index.js?

Given the following file structure:

myFiles
├── index.js
├── getTrue.js
└── dependentGetFalse.js

And the following code

// index.js
export { getTrue } from './getTrue'
export { dependentGetFalse } from './dependentGetFalse'
// getTrue.js
export const getTrue = () => true
// dependentGetFalse.js
import { getTrue } from '.'
export const dependentGetFalse = () => !getTrue()

Where there's (what I assume to be) a circular import between dependentGetFalse.js and index.js.

What problems will arise from this? Or is it ok to have?

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

0

If your codes run flawless and you are comfortable with them, It is ok to have this circular situation

about 4 years ago · Juan Pablo Isaza Denunciar

0

It's best to avoid using '.' imports.

Try this:

// dependentGetFalse.js
import { getTrue } from './getTrue'
export const dependentGetFalse = () => !getTrue()

index.js is useful when you try to import something from outside of this folder.

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