2.1.50 Editor won't show when addons load many js files


There’s a bug where having 3 add-ons (Wrapper meta, Closet, and Field Autocomplete) makes the editor webview to show up blank on v2.1.50 qt5. (As in <body></body>)

The following is the error message shown in the inspector.

Uncaught (in promise) TypeError: Cannot read property '$$' of undefined
    at ht (browser_editor.js:34)
    at new oL (browser_editor.js:105)
    at nI (browser_editor.js:105)

Investigating the issue, it looks like the issue occurs when the total size or the number of all javascript files added to WebContent are too big. I don’t know if this is caused by Anki, Svelte, or something else, so reporting it here.

Steps to reproduce

Below is a minimal add-on code you can use to test this issue. 50m.js is a 50MB js file containing a huge comment block and nothing else.

from aqt import mw
from aqt.gui_hooks import webview_will_set_content

mw.addonManager.setWebExports(__name__, r".*(css|js)")
addon_package = mw.addonManager.addonFromModule(__name__)

def include_js(webcontent, context):


Can be reproduced on both qt5 and ARM qt6 of v2.1.50, MacOS. On Qt5, a 10MB js file is enough to break the editor, while Qt6 has 50% chance of breaking on a 50MB file. As more js files are added, less total size is needed to break the editor.


  • Huge CSS files don’t cause this error.
  • When the script is added to the end of <body>, the editor works fine.
  • This issue doesn’t exist on v2.1.49



Thanks for the repro; Load page script after body by dae · Pull Request #1802 · ankitects/anki · GitHub should fix it.

1 Like