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

222
Vistas
Why does async + await return AsyncFunction?

code

const config = async () => {
  return await import("../test");
}

console.log(config);

../test

export const config = {
  value1: 1,
  value1: 2,
};

I want config in ../test but this returns [AsyncFunction: config].

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

0

async () => {} is a function declaration. So you assigned config to a function.

You have to call that function, and await the result, in order to get the value you want.

console.log(await config());

But are you sure you want a dynamic import here?

Because this should do the same thing without any headaches at all.

import { config } from "../test";
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