mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.2k stars 1.16k forks source link

initialize:160 Error loading MathJax: TypeError: Cannot set property Package of #<Object> which has only a getter #3289

Open quanzhongxian opened 1 month ago

quanzhongxian commented 1 month ago

import "mathjax-full/es5/tex-svg-full"; image

dpvc commented 1 month ago

This is a duplicate of #3106, and the earlier #3079.

Because this is occurring while handling the MathJax configuration, we can't use the usual MathJax.startup.ready() function to fix it. It is fixed in v4 (currently in beta release), but not in v3.

The fix is in this commit. You could edit the ts/components/global.ts file to make the combineConfig() function be

https://github.com/mathjax/MathJax-src/blob/43bb7d905c1891f0fd3b5459dc0ec2f90c650845/ts/components/global.ts#L85-L102

and recompile it using npm run -s compile, then rebuild the tex-svg-full component using npm run -s make-components (which will rebuild everything, so it will take a while), that should allow it to work for you.

Sometimes the presence of a MathJax configuration can prevent this. There is also some discussion in #3079 about it, but no other solution.