Moodle 2.9 (moving to 3 not an option I'm afraid), I'm trying to load a 3rd party javascript module via AMD and it's giving me the error:
require.js:166 Uncaught Error: Mismatched anonymous define() module
I'm getting this before I even try to use it, just having it in the theme amd folder is causing it (it still happen if I try to make use of it, too).
The module in question is masonry (http://masonry.desandro.com/) and it supports loading via requirejs (supposedly). The module definition is as follows:
( function( window, factory ) { // universal module definition /* jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD define( [ 'outlayer/outlayer', 'get-size/get-size' ], factory ); } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( require('outlayer'), require('get-size') ); } else { // browser global window.Masonry = factory( window.Outlayer, window.getSize ); } }( window, function factory( Outlayer, getSize ) { // module code }
Loading it manually via the theme config.php javascripts array seems to work, but I'd like to make use of the AMD loader if possible. Any ideas?