Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems with Vite, ordering of import statements #152

Closed
arshaw opened this issue Jun 10, 2021 · 18 comments
Closed

problems with Vite, ordering of import statements #152

arshaw opened this issue Jun 10, 2021 · 18 comments
Milestone

Comments

@arshaw
Copy link
Member

arshaw commented Jun 10, 2021

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: fullcalendar/fullcalendar#6371

@Narven
Copy link

Narven commented 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 🙇

@Narven
Copy link

Narven commented Aug 8, 2021

That really should be in the docs... somewhere... with huge spotlights and arrows pointing to it.

@AdrianMrn
Copy link

AdrianMrn commented 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';

@ge-lem
Copy link

ge-lem commented Mar 11, 2022

This is working for
import dayGridPlugin from '@fullcalendar/daygrid'
but not for
import timeGridPlugin from '@fullcalendar/timegrid'

EDIT
Working after npm update ...

@kyar1s
Copy link

kyar1s commented May 17, 2022

import '@fullcalendar/react/dist/vdom';

OMG.. im now

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

Oh, you have just become my best friend, I had tried everything for that error and here is the solution, thank you very much!

@amine-elghazali
Copy link

amine-elghazali commented Jul 20, 2022

I'm Trying to implement FullCalendar into my Nuxt3 project, But I keep getting an error that says : vite_ssr_import_1 is not defined

Please help guys ^^'

@castrix
Copy link

castrix commented Jul 28, 2022

I just met this issue in vite react, and I just want to add that you can import the @fullcalendar/react/dist/vdom in app level or index level. What I mean by that is that you don't need to import it in every file that import @fullcalendar, so you just need to import @fullcalendar/react/dist/vdom once in your highest level file.

@kcirefrz
Copy link

kcirefrz commented Aug 3, 2022

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

You saved me!! ty

@arshaw arshaw added this to the v6 milestone Aug 7, 2022
@renatosaz
Copy link

For some unknown reason, if I import fullcalencar/vue3 in my vue3 + vite + typescript project, all the components becomes red on visual studio with the following error : "any component name" cannot be used as a JSX component. / JSX element class does not support attributes because it does not have a 'props' property / It complains many other things to. I know for sure it is related to importing vuecalendar3. How can I fix this ? regards.

@hkc512
Copy link

hkc512 commented Aug 22, 2022

For some unknown reason, if I import fullcalencar/vue3 in my vue3 + vite + typescript project, all the components becomes red on visual studio with the following error : "any component name" cannot be used as a JSX component. / JSX element class does not support attributes because it does not have a 'props' property / It complains many other things to. I know for sure it is related to importing vuecalendar3. How can I fix this ? regards.

Hi,you have the solution? i having this error after import fullcalendar too.

@techpool
Copy link

techpool commented Sep 18, 2022

For some unknown reason, if I import fullcalencar/vue3 in my vue3 + vite + typescript project, all the components becomes red on visual studio with the following error : "any component name" cannot be used as a JSX component. / JSX element class does not support attributes because it does not have a 'props' property / It complains many other things to. I know for sure it is related to importing vuecalendar3. How can I fix this ? regards.

Anything to solve this? I have the exact same issue!

@damisparks
Copy link

For some unknown reason, if I import fullcalencar/vue3 in my vue3 + vite + typescript project, all the components becomes red on visual studio with the following error : "any component name" cannot be used as a JSX component. / JSX element class does not support attributes because it does not have a 'props' property / It complains many other things to. I know for sure it is related to importing vuecalendar3. How can I fix this ? regards.

Anything to solve this? I have the exact same issue!

@techpool follow the suggestions on the thread and you are good to do.

@Steve-madlad
Copy link

To get the FullCalendar Vue plugin working with Vite's HMR, you'll need to import @fullcalendar/core/vdom

You are a life saver man! been racking my brain for solutions.

@arshaw
Copy link
Member Author

arshaw commented Dec 15, 2022

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

@arshaw arshaw closed this as completed Dec 15, 2022
@jairo-ab
Copy link

I'm using the library in Vue version 2.7 + Vite. How can I make this work?

@subashdbc
Copy link

@jairo-ab
Just import this on main.js file import '@fullcalendar/core/vdom' on the top level

It works as expected!

@GustavoMelloGit
Copy link

GustavoMelloGit commented Dec 28, 2023

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

@KNR1997
Copy link

KNR1997 commented Jan 4, 2024

Thanks bro. It saves my day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests