NightMICU
NightMICU

Reputation: 9230

Using jQuery plugin imported with Browserify

I am trying to begin using Browserify in a project but I am a bit confused how to actually use plugins that are imported into my script using require().

Specifically, I am trying to use the fullCalendar plugin -

var fullCalendar = require('fullcalendar')
$(document).ready(function() {
    $("#calendar").fullCalendar({});
});

When this loads, I get an error that fullCalendar is not defined. If you import a jQuery plugin using this method is it then called differently? If so, how?

I am using Laravel Elixir (gulp).

Upvotes: 2

Views: 586

Answers (1)

marcel
marcel

Reputation: 3149

Try this:

global.$ = require('jquery'); // or global.jQuery
require('fullcalendar');

See this for more information.

Upvotes: 1

Related Questions