Page MenuHomePhabricator

CodeMirror loads unconditionally with VE
Closed, ResolvedPublic

Description

Code mirror registers itself with VisualEditor.PluginModules in extension.json. This means it loads along with the editor unconditionally - even though it is used in a minority of VE sessions (user must have VE source mode enabled as well as syntax highlighting).

The CodeMirror v6 packages are 190k, which is not insignificant on slower mobile connections.

We should be loading minimal code on init (toolbar tools etc.), and everything else lazily at least when source mode is started or ideally when highlighting is started.

Event Timeline

Change #1213583 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@master] performance: lazy load CM module when VE wikitext editing session begins

https://gerrit.wikimedia.org/r/1213583

MusikAnimal changed the task status from Open to In Progress.Dec 1 2025, 10:39 PM
MusikAnimal claimed this task.

Change #1213583 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] performance: lazy load CM module when VE wikitext editing session begins

https://gerrit.wikimedia.org/r/1213583