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

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

Closed
satishbluone opened this issue Sep 1, 2020 · 7 comments

Comments

@satishbluone
Copy link

I am using below versions:
"@fullcalendar/angular": "^5.3.0",
"@fullcalendar/bootstrap": "^5.3.0",
"@fullcalendar/core": "^5.3.0",
"@fullcalendar/daygrid": "^5.3.0",
"@fullcalendar/interaction": "^5.3.0",
"@fullcalendar/list": "^5.3.0",
"@fullcalendar/timegrid": "^5.3.0",

and "typescript": "~3.8.3"
Angular v9.1

It's working well in development mode.
but getting the error "Please import the top-level fullcalendar lib before attempting to import a plugin." in production.
I already moved the "FullCalendarModule" on top of all modules.
please help me to resolve this issue.

@acerix
Copy link
Member

acerix commented Sep 3, 2020

I believe it's the same issue that was reported here:
#306

So it should work if you include the plugins as described here:

https://fullcalendar.io/docs/angular

@acerix acerix closed this as completed Sep 3, 2020
@satishbluone
Copy link
Author

I resolved it myself.
Thanks.

@faisalshafisit
Copy link

@satishbluone How did you solve this. Please explain.
I'm stuck in the same issue after upgrading my angular 7 application to angular 10 with aspnetboilerplate.

@satishbluone
Copy link
Author

@faisalshafisit please follow the below steps:

  1. Add FullCalendarModule in module file and don't register plugins in module file.
  2. now import all plugins according to your requirements in Component file and then use the below code to register your plugins
    calendarOptions: CalendarOptions = {
    plugins: [ dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin, bootstrapPlugin ],
    themeSystem: "bootstrap",
    .......
    .......
    .......
    }

@ajaykumarsana
Copy link

@satishbluone ,
@faisalshafisit

looks like below solution would fit best:
import { Calendar } from '@fullcalendar/core';
in constructor of the component.ts file, add below
constructor() { const name = Calendar.name; }

@Slavrix
Copy link

Slavrix commented Jun 10, 2021

This is what I did to solve this in my project.

in my module import in this order and register my plugins.

import { FullCalendarModule } from "@fullcalendar/angular";
import dayGridPlugin from '@fullcalendar/daygrid';
import interactionPlugin from '@fullcalendar/interaction';
import listPlugin from '@fullcalendar/list';
import momentPlugin from '@fullcalendar/moment';
import rrulePlugin from '@fullcalendar/rrule';
import timeGridPlugin from '@fullcalendar/timegrid';

FullCalendarModule.registerPlugins([
  dayGridPlugin,
  interactionPlugin,
  listPlugin,
  momentPlugin,
  rrulePlugin,
  timeGridPlugin
]);

in the component I use this inside my constructor just before I prepare my calendarOptions

forwardRef(() =>Calendar);

@arshaw
Copy link
Member

arshaw commented Jun 11, 2021

I've written something explaining why this problem is happening and how I plan to solve it in the future: #371

@fullcalendar fullcalendar locked and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants