MathJax-demos-node icon indicating copy to clipboard operation
MathJax-demos-node copied to clipboard

ESM dependency

Open alex-mashin opened this issue 1 year ago • 2 comments

Since node.js 20.10, ESM module does not work (standard-things/esm/#931), and as the repository was archived on exactly the same day that the issue was filed, it is not likely that ESM will be fixed.

The examples in the repository depend on ESM. Can this dependency be removed? If it can, could the developers update the examples, or at least give the general guidelines how to remove the dependency?

alex-mashin avatar Dec 27 '24 03:12 alex-mashin

Replacing require with something like import( 'mathjax-full/es5/node-main.js' ).then(…) can help.

alex-mashin avatar Dec 30 '24 09:12 alex-mashin

Version 4 (currently out in beta release) has both ESM and CommonJS versions. The demos will be updated for the official release.

Not all the demos here use the esm library. For example, the "direct" versions in

https://github.com/mathjax/MathJax-demos-node/tree/master/direct

don'e use esm. The v3 demos use esmwhen you are loading the MathJax components from source, but if you use the--dist` command-line option available on most of the demos, it should not be needed.

In any case, the demos will be updated for v4 what that is officially released.

dpvc avatar Dec 30 '24 16:12 dpvc