Javascript AMD Module Setup for a Plugin

Javascript AMD Module Setup for a Plugin

by Ben Hadden -
Number of replies: 1

I am writing a plugin for Moodle as part of a university project. Currently, I cannot get a basic AMD module setup to work within my plugin, the purpose of using an AMD module is to eventually run a plotly javascript chart library. In the browser an error occurs when loading the "module.js" file via "view.php".

Here is my github repositry .

I have been writing the AMD module based on the following guides:

Using NPM Grunt, I generated the "module.min.js" and "module.min.js.map" files which appears to have worked correctly. However, when I call the js_call_amd() function in "view.php", an 'Uncaught SyntaxError' appears in the browser.

Can I get some advice, as to why the AMD module is not running? Any suggestions would be really helpful.

Thanks,
Ben


Average of ratings: -
In reply to Ben Hadden

Re: Javascript AMD Module Setup for a Plugin

by Conn Warwicker -
Picture of Core developers Picture of Plugin developers
The "got <" most likely means there was an error behind the scenes in your PHP, which has malformed the javascript in some way. Have a look in your error logs.