Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

344
Visualizações
FullCalendar Dynamic Import

I'm trying to import Full Calendar dynamically to only load it when needed and have the following:

    (async () => {
        console.log('Hello 0');
        const Calendar = await import('@fullcalendar/core');
        console.log('Hello 1');
        const { default: dayGridPlugin } = await import('@fullcalendar/daygrid');
        console.log('Hello 2');

        let calendarEl = document.getElementById('calendar')

        let calendar = new Calendar(calendarEl, {
            plugins: [dayGridPlugin]
        });
    })();

I can't see why this is failing. I just get the following error:

vdom.js:3 Uncaught (in promise) Error: Please import the top-level fullcalendar lib before attempting to import a plugin.

Also the "Hello 0" is output but not any of the other console logs.

I'd expect the core library to load, followed by the daygrid plugin, but it appears like the plugin is actually loading first, hence the warning in the error. Isn't the await call next to line 3 meant to ensure that. the core library is fully imported before moving on?

Why is that not happening?

Any suggestions?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda