Kernel with CodeMirror simpleMode defined, not surviving refresh

Hi there guys,

I wrote a kernel with syntax highlighting built-in. It works great! I load it up, and everything highlights with the colors I gave it. The issue though is that the syntax highlighting doesn’t work when I refresh the page. I don’t know what I’m doing wrong, as I can’t find any help information on this.

Here’s what I have for the kernel.js file

['codemirror/lib/codemirror', 'codemirror/addon/mode/simple'],
function(CodeMirror) {
  return {
    onload: function(){
        CodeMirror.defineSimpleMode('<name_of_langauge>', {
        /* definitions here */

I am seeing in the console the 404 message:
But I get this on the first load as well (I don’t understand why it’s trying to load that, either.

Any insight is appreciated.

There are a few codemirror related questions here but none appeared to be answered… I have raised an issue at the issue tracker (Properly way to define new CodeMirror mode in JLab extension · Issue #10095 · jupyterlab/jupyterlab · GitHub) but cannot help noticing that it was one of the 1.7k unresolved issues there :frowning: