General developer forum

AMD Module moment.js loaded via require.js produces mistmatch error

 
Picture of Yamel Hall
AMD Module moment.js loaded via require.js produces mistmatch error
 

I need to implement the daterangepicker.js library to a custom block plugin I am a building.

I am using this library:

https://raw.githubusercontent.com/dangrossman/bootstrap-daterangepicker/master/daterangepicker.js


This library has as dependencies, jquery, jquery UI &  moment.js. All of the dependencies but the last one are already loaded by require.js in moodle core. 

I am simply adding the library moment.js to the JavaScripts loaded by my theme via the config.php file.

Immediately I get the http://requirejs.org/docs/errors.html#mismatch error. 
Moment.js checks if require.js is present to load AMD modules if so it should be able to define the module and return the object. However, there is a problem that is not allowing the module to be defined.

Is there something different I should be doing to load the AMD module moment.js ?

I have tried with 2 themes, I used Clean theme without any javascript loaded to make sure any of my scripts were not the issue. It might be worth mentioning that I have used moment.js successfully in other frameworks.

Thank you for any provided help.

 
Average of ratings: -