# Upgrading Mathjax to version 4

**URL:** https://meta.discourse.org/t/upgrading-mathjax-to-version-4/392669
**Category:** Development
**Tags:** math
**Created:** [November 23, 2025, 5:57pm UTC](https://meta.discourse.org/t/upgrading-mathjax-to-version-4/392669 "2025-11-23T17:57:05Z")
**Posts on this page:** 1
**Showing post:** 17

<div class="post-metadata">

### Author: ![mcmcclur](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcmcclur/32/115456_2.png) [@mcmcclur](https://meta.discourse.org/u/mcmcclur)
#### Post date: [December 24, 2025, 12:49pm UTC](https://meta.discourse.org/t/upgrading-mathjax-to-version-4/392669/17 "2025-12-24T12:49:21Z")

</div>

> [@sam](#):
>
> can you double check my latest commit, I think I added a funnel for ember so now the ember build puts all the files in the right place.

OK, I’ve got some very good news and some frustrating news.

First, you’re absolutely right that adding the funnel places those files in the correct place. I added the funnel to my branch and it now works great without the CDN dependancy. 🎉

Unfortunately, I am unable to run your code at the moment. Whenever I navigate to a page with math on it, the math does not typeset and I see the following error message in the console:  
Uncaught (in promise) Error: State EXPLORER already exists

I’m certain I had your code working before so I suppose it’s something I did. To be clear, though, I literally started an entirely fresh directory using the techniques described in [Install Discourse on macOS for development](https://meta.discourse.org/t/install-discourse-on-macos-for-development/15772).

```plaintext
git clone https://github.com/discourse/discourse.git ./discourse
cd ./discourse
bundle install
pnpm install
bundle exec rake db:create
bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate

# In one terminal
bundle exec rails server

# In another terminal
bin/ember-cli

```

I then grabbed your code with

```plaintext
git checkout 71ad0305f812311f2a4570edf7c33f97de46c457
git switch -c mathjax-sam

```

Even from that fresh setup, I get the error.

* * *

At this point, I’m pretty happy with my version of the code but still curious about what’s going on with yours. I need to take a break from this for the holiday, though. I’m happy to take another look at it in a few days time.

One final point, though: As far as I know,

```plaintext
await import("tex-mml-chtml.js") // followed by
await import("input/asciimath.js")

```

shouldn’t work, which is effectively what your code is doing, I think.

I’m being imprecise with paths there but my point is that I don’t know that consecutive dynamic calls to import lead to the correct MathJax structure. I think that loading MathJax components is pretty complicated and that’s why they’ve got such a detailed loading process with the MathJax object and all.

Thanks so much for your help and patience @sam!

---

_[View the full topic](https://meta.discourse.org/t/upgrading-mathjax-to-version-4/392669)._
