It doe snot need to be inside a module. You just need to require the module inside the {{#js}} section of your mustache file:
{{#js}}
require(['core_courseformat/local/courseeditor'], function(editor) {
const currentCourse = editor.getCurrentCourseEditor();
});
{{/js}}
{{#js}}
require(['core_courseformat/local/courseeditor'], function(editor) {
const currentCourse = editor.getCurrentCourseEditor();
});
{{/js}}