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.

problems with Vite, ordering of import statements

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:26
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
AdrianMrncommented, Mar 9, 2022

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

8reactions
Narvencommented, Aug 8, 2021

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 🙇

Read more comments on GitHub >

github_iconTop Results From Across the Web

Console error on import of non-existent file in vite
I am migrating from webpack using Vue2.7 and @vitejs/plugin-vue2. So there was one problem ...
Read more >
API - esbuild
If you want to conditionally import a file only if the export is actually used, you should mark the injected file as not...
Read more >
Documentation - Module Resolution - TypeScript
Consider an import statement like import { a } from "moduleA" ; in order to check ... If you are having resolution problems...
Read more >
Static Asset Handling - Vite
The behavior is similar to webpack's file-loader . The difference is that the import can be either using absolute public paths (based on...
Read more >
Getting error `Cannot use import statement outside a module ...
On 10/15/2021 at 11:49 AM, chanced said: I'm using Vite which supports ESM. It doesn't look like it supports ESM with SSR. This...
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