plyr: plyr not loaded with Require.js define dependency
Hi,
I’m trying to load plyr via Require.js by using a module dependency like that:
define(['jquery', 'plyr'], function (jquery, plyr) {
plyr.setup(); // plyr is null
});
But the problem is that plyr is null. I didn’t used shim option since I saw that plyr is using define as expected by Require.js.
Do you have any idea why is this not working ? I also tried to do a require directly, but same result the module plyr is not loaded.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (8 by maintainers)
For information I fixed the problem by changing the module declaration inside plyr.js file like so:
} else if (typeof define === 'function' && define.amd) {
// AMD
define([], function () { return factory(root, document); });
} else {
As you can see I changed the null value by an empty array and I return the value from the factory so that I can use the plyr setup method in my own module.
I don’t know if I’m doing right since I’m completely new on require.js, but for development purpose I will work like that for now. If you can enlight me on that issue when you get time, I’ll appreciate 👍
Thank you for you help!