Cannot install converseJS properly in Laravel 5

690 views Asked by At

I am working on an application where I am trying to get the chat feature working by using the ConverseJS XMPP client on the front end and Openfire RTC on the back end.

I am working with Laravel 5 on the back end, and being the naive developer I am, I placed the files in the public folder and linked the JS and CSS file to the webpage.

<link rel="stylesheet" type="text/css" media="screen" href="/converse/css/converse.min.css">
<script src="/converse/builds/converse.min.js"></script>

It is working in Firefox and I can see the chat pluigin but in Chrome. The error I see in the console is:

Uncaught Error: See almond README: incorrect module build, no module name

I am not sure what is causing this. Placing the files in the public folder and linking it to the pages, is this the right way? Or do I have to do something extra in Laravel 5 to get it running?

1

There are 1 answers

0
Ghitu Ilie-Alin On BEST ANSWER

You receive this error because conversejs uses Almond as a AMD loader and it cannot handle modules without a name.

For example this will trow the error you mentioned:

$(function(){
    ...
});

So you should use something like this instead:

jQuery(function($){
   ...
});

More info here

Try to put the conversejs script last and wrap the code for jQuery plugins as mentioned before.