Problem using fullCalendar from npm


#1

Installing (using Meteor 1.5.1) is not a problem:

meteor npm install fullcalendar --save

Importing either of the two ways below does not throw an error:

import fullCalendar from 'fullcalendar';
or
import 'fullcalendar';

However, when initializing the Calendar, I get the error:

TypeError: $(...).fullCalendar is not a function

Has anyone been able to successfully use the npm version of fullcalendar in Meteor? (I also want to eventually use fullcalendar-scheduler as well.)


#2

I’m not using this package but have you tried
import {fullCalendar} from 'fullcalendar';


#3

Hmmm, I should have tried that. I ended up creating a local package using the latest version to get around my problem. When I have a moment, I’ll give that a try and update this topic.


#4

I believe the problem stems from having multiple version of jQuery being loaded.

See: https://stackoverflow.com/questions/29867859/fullcalendar-is-not-a-function

I have another much simpler Meteor project to which I added fullcalendar using npm, and it works in that project just fine. Any ideas how to solve this multiple jQuery issue in Meteor?

Also see: 1.3.2.2 contains two jquery versions

BTW, import {fullCalendar} from 'fullcalendar' did not solve the issue.


#5

From what I found out today, fullcalendar has a dependency on jquery 2-3. In my meteor app I had jquery 1.12, so fullcalendar was not able to handle that. After setting the version of fullcalendar to ^2.9.1 I was able to see some output.

So I am using those two lines in my package.json:

"fullcalendar": "^2.9.1",
"jquery": "^1.12.4",

and I need the following imports on the template with fullcalendar:

import $ from 'jquery';
import { } from 'fullcalendar';
import 'fullcalendar/dist/fullcalendar.css';

Maybe this helps a bit.