title: Loading CodeMirror with RequireJS from CDN
body: <p>I want to make an online javascript demo and I want to allow users to alter demo behavior through changing the code. My project uses RequireJS with big success so I decided to stick with it. First I tried to load editor through absolute URL paths:</p>
  
  <pre><code>require(
    [
          "//cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/codemirror.js",
          "//cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/mode/javascript/javascript.js",
          "//cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/addon/comment/continuecomment.js",
          "//cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/addon/edit/matchbrackets.js",
          "//cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/addon/comment/comment.js"
    ],
    (CodeMirror)=&gt;{
          var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
            lineNumbers: true,
            matchBrackets: true,
            continueComments: "Enter",
            extraKeys: {"Ctrl-Q": "toggleComment"}
          });
    }
  );
  </code></pre>
  
  <p>Require JS tries to load this path then: <code>http://cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/lib/codemirror</code> That's obviously wrong because</p>
  
  <ol>
  <li>I didn't ask it to put <code>/lib/</code> in front of my path, so why did it do so?</li>
  <li><code>.js</code> is missing.</li>
  </ol>
  
  <p>After that failure, I tried to configure requireJS and use relative paths:</p>
  
  <pre><code>requirejs.config({
      paths: {
          codemirror: [
              "//cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/"
          ]
      },
      waitSeconds: 20   
  });
  
  require(
    [
          "codemirror/codemirror",
          "codemirror/mode/javascript/javascript",
          "codemirror/addon/comment/continuecomment",
          "codemirror/addon/edit/matchbrackets",
          "codemirror/addon/comment/comment"
    ],
    (CodeMirror)=&gt;{
          var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
            lineNumbers: true,
            matchBrackets: true,
            continueComments: "Enter",
            extraKeys: {"Ctrl-Q": "toggleComment"}
          });
    }
  );
  </code></pre>
  
  <p>This time, <code>.js</code> is there but the path is still wrong: <code>http://cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4//lib/codemirror.js</code> Notice the double slash.</p>
  
  <p>I didn't ask RequireJS to put random stuff in the path I specified, so why does it do so? How can I make this work?</p>