Skip to content

Commit

Permalink
MDL-60458 javascript: MathJax Workaround
Browse files Browse the repository at this point in the history
Mathjax currently has a bug in an upstream library that is incorrectly
loading 'process' because it things it's running under Node.js.

We don't load modules by shortname - so it should be fine to map process to
something else.

Because of the syntax they used we need to map it to something that is already loaded
and evaluates to null (Their code will then assume the module could not be loaded and continue).

We have a handy module that is guaranteed to be loaded first and evaluates to null -> core/first.

We should remove this workaround when MathJax releases a fixed version on their CDN and update the docs.
  • Loading branch information
Damyon Wiese committed Oct 25, 2017
1 parent 89ceede commit 7b18365
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/requirejs/moodle-config.js
Expand Up @@ -16,6 +16,8 @@ var require = {
// '*' means all modules will get 'jqueryprivate'
// for their 'jquery' dependency.
'*': { jquery: 'jqueryprivate' },
// Stub module for 'process'. This is a workaround for a bug in MathJax (see MDL-60458).
'*': { process: 'core/first' },

// 'jquery-private' wants the real jQuery module
// though. If this line was not here, there would
Expand Down
1 change: 1 addition & 0 deletions lib/requirejs/readme_moodle.txt
@@ -1,3 +1,4 @@
Description of import into Moodle:
// Download from https://requirejs.org/docs/download.html
// Put the require.js and require.min.js and LICENSE file in this folder.
// Check if MDL-60458 workaround can be removed.

0 comments on commit 7b18365

Please sign in to comment.