Address JS / AMD issues in Catalyst Report

Issue #40 resolved
Jeremy Hopkins created an issue

Our hosting provider catalyst has completed a code review of this plugin. Aside from some issues that were present in the previous version of the plugin (prior to Branchup development) there is one issue they are flagging as “red” which we would like addressed.

An excerpt describing that issue is given below, I will send the full report via email.

“The issue raised that causes the plugin review to be red, though, is the fact that the code bundled into the amd folder is not in AMD format, causing Moodle to fail to load all JavaScript (the entire Moodle JS is replaced with “JS file: /mod/peerwork/amd/src/revised-grades-total-calculator.js cannot be loaded, or does not contain a javascript module in AMD format. "define()" not found.”“

Comments (6)

  1. Frédéric Massart

    Rewrite ES6 modules in ES5. Refs #40

    It was discovered that using ES6 modules does not work when testing the plugin in development mode in older versions, which can be an issue. So the relevant AMD modules were rewritten to use the older define format.

    → <<cset bdcb3ec2eaf4>>

  2. Frédéric Massart

    Hi Jeremy,

    After some investigation, I agree with Catalyst that this is a blocker. We were not aware that ES6 JavaScript modules would only work on 3.8 onwards in development mode, and would completely break the entire frontend in Moodle 3.7 and older.

    Production mode would have worked fine, but it is important to be able to run websites in development mode so we rewrote the modules in ES5.

    Apologies for the inconvenience. We unfortunately now have to patch several of other plugins we worked on for other clients.

    Thank you for the report!

  3. Jeremy Hopkins reporter

    Thanks for this, can you confirm whether the commit referenced above fixes this issue for us, I believe it does?

  4. Log in to comment