I use SystemJS
to build an Angular 2
application and I'd like to start using MathJax
in a component. I installed with:
npm install --save-dev mathjax
npm install --save @types/mathjax
MathJax is now installed in /node_modules/mathjax
. When my component does import "mathjax"
, the file /node_modules/mathjax/MathJax.js
is loaded. So far so good.
Problem is that this file then tries to load other files using paths relative to the project root instead of the MathJax install directory.
For instance, MathJax.js
tries to load
/extensions/MathMenu.js 404 Not found
/extensions/MathZoom.js 404 Not found
The correct paths are
/node_modules/mathjax/extensions/MathMenu.js
/node_modules/mathjax/extensions/MathZoom.js
A quick look inside the source files show that the URLs are referred to this way:
[MathJax]/extensions/MathMenu.js
Any idea where I should look to fix this? I know I shouldn't alter the MathJax.js
file itself since any change will be overwritten after an update. It also doesn't make sense to use htaccess
or other server-side redirects.
I'm aware that I can load a working MathJax bundle by using the CDN:
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_SVG"></script>
However I'm trying to learn how to integrate the library into my build setup.