now use dynamic import() and rely on Babel to polyfill

This commit is contained in:
JFH
2020-08-07 22:12:40 +02:00
parent 06c48ec088
commit 72df064ea3
7 changed files with 34 additions and 235 deletions

View File

@@ -7,8 +7,6 @@
* @copyright 2013 Jo Segaert
*
*/
// Todo: Wait for Mathjax 3.0 to get ES Module/avoid global
import {importScript} from '../../external/dynamic-import-polyfill/importModule.js';
export default {
name: 'mathjax',
@@ -204,7 +202,8 @@ export default {
// We use `extIconsPath` here for now as it does not vary with
// the modular type as does `extPath`
try {
await importScript(svgEditor.curConfig.extIconsPath + mathjaxSrcSecure);
// eslint-disable-next-line node/no-unsupported-features/es-syntax
await import(svgEditor.curConfig.extIconsPath + mathjaxSrcSecure);
// When MathJax is loaded get the div where the math will be rendered.
MathJax.Hub.queue.Push(function () {
math = MathJax.Hub.getAllJax('#mathjax_creator')[0];