fullcalendar-vue: problems with Vite, ordering of import statements

To get the FullCalendar Vue plugin working with Vite’s HMR, you’ll need to import @fullcalendar/core/vdom for its side-effects before any other import. Example from the docs:

import '@fullcalendar/core/vdom' // solves problem with Vite
import FullCalendar from '@fullcalendar/vue'
import dayGridPlugin from '@fullcalendar/daygrid'
import interactionPlugin from '@fullcalendar/interaction'

This configuration is recommended for other bundlers too, not just Vite, because it guarantees the ordering of import statements that FullCalendar internally needs. It prevents the JS error Please import the top-level fullcalendar lib before attempting to import a plugin.

The goal is to do away with this ordering requirement. See the following issue for more info: https://github.com/fullcalendar/fullcalendar/issues/6371

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 34
  • Comments: 18 (1 by maintainers)

Most upvoted comments

For anyone else using Vite to build a React application, you need to add this line instead: import '@fullcalendar/react/dist/vdom';

Man… u are my 🦸‍♂️ today. I’ve just spent 4 hours trying to get vite to work fullcalendar with the issue:

Please import the top-level fullcalendar lib before attempting to import a plugin.

and that:

import '@fullcalendar/core/vdom'

just saved me another day of searching and punching my monitor. (my hands are hurting already)

Thanks 🙇

I am still getting this error on 6.1.10 and i cant use @AdrianMrn solution because this file does not exist anymore

Fixed in v6.0.0. A workaround is no longer needed.