How to import MathJax in ESM modules?
I’m trying to import and use MathJax within a browser-based ESM module using various flavors of importing including the following:
import * as MathJax from 'mathjax/es5/tex-svg';
import 'mathjax/es5/tex-svg';
Attempted usage is as follows:
MathJax.tex2svg(String.raw`${text}`);
This throws a TypeError
stating MathJax2.tex2svg is not a function
. I installed MathJax using:
npm install mathjax
How can one import and use MathJax in a browser-based ESM environment where the dependency is managed by npm. If it’s at all helpful, I’m using esbuild for bundling.
Read more here: Source link