Use requirejs
codemirror mode setup with requirejs