question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

This JS error occurs when a FullCalendar plugin, like @fullcalenar/daygrid or @fullcalendar/timeline, is imported before @fullcalendar/core or one of the connector libraries, like React, Vue, or Angular. I will backlink tickets related to each of these three frameworks to this main ticket.

It is obviously not good to have ordering restrictions for an end-developer’s import statements. The goal is to do away with this restriction.

The restriction exists for reasons that are internal to FullCalendar’s rendering code: FullCalendar is designed to work with an abstract component/jsx implementation. Either React or Preact. When FullCalendar’s component classes are being created at the top-level runtime, they need to know what Component class to subclass. Thus, either React or Preact needs to be available at that time.

Version 6 will sidestep this issue by using (p)react hooks for rendering. With hooks, there is no longer the need to subclass a Component class.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:11
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

60reactions
AdrianMrncommented, Mar 9, 2022

@duckbrain Thanks for pointing me in the right direction! I’m bundling a React application with Vite, so this fix didn’t work for me. However, adding this line does fix it: import '@fullcalendar/react/dist/vdom'; 🎉

4reactions
casually-creativecommented, Jul 10, 2022

I am receiving the same error when using snowpack to compile my files. I assume the underlying issue is the same as the one with Vite. When adding import '@fullcalendar/react/dist/vdom'; as AdrianMrn suggested, the issue was fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Please import the top-level fullcalendar lib before attempting ...
It's working well in development mode. but getting the error "Please import the top-level fullcalendar lib before attempting to import a plugin.
Read more >
fullcalendar lib before attempting to import a plugin
For fixing this issue you need to import calendar core library at the top, then you need to initialize core lib in your...
Read more >
Issue with Fullcalendar on Diamon Layout - PrimeFaces forum
After that I got an issue with Fullcalendar. Error shown: Please import the top-level fullcalendar lib before attempting to import a plugin.
Read more >
FullCalendar - JavaScript Event Calendar
Lightweight. Reduce your project's bundle size by using FullCalendar's modular plugins. Learn more.
Read more >
Angular – fullcalendar lib before attempting to import a plugin
... Please import the top-level full calendar lib before attempting to import a plugin. at Module../node_modules/@fullcalendar/common/vdom.js (vdom.js:3) at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found