You’re likely calling it from a sub-window where require is not yet defined. This is fixed in Komodo 11 but in 10 you have to work around it by loading the require module itself. You can do this by including the following JS in your window:
let [Cc, Ci] = [Components.classes, Components.interfaces];
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://komodo/content/jetpack.js", this);
Thanks for the code. However, it’s not working at all for me.
I do have a dialog window which is called from a menu item. However, when I wrap the above statement between console.log(…), I find that it fails.
I have tried this at the very beginning of the script, as well as inside the function which needs the require. I have also tried with and without 'use strict';. I have also tried to break it down into components, and it appears that Cc["@mozilla.org/moz/jssubscript-loader;1"] is not working.