简体   繁体   中英

How do I configure require js to use local copy of codemirror

This code works when I access codemirror over the web:

var modules = ["lib/codemirror"];
requirejs.config({
    baseUrl: 'http://codemirror.net/'   
});
requirejs(modules, function (CodeMirror) { .. etc.

However I now wish to use a local codemirror.js file in my Scripts directory but the configuration fails to load codemirror. Here is my new code which does not work. I've tried several variations on specifying the baseUrl but no luck. Thanks for taking a look at this issue.

var modules = ["codemirror"];
requirejs.config({
    baseUrl: './Scripts',
    paths:  {
          'codemirror', '/codemirror'
    }
});
requirejs(modules, function (CodeMirror) { .. etc.

Looks like a typo to me. This is not something RequireJS can use:

paths:  {
      'codemirror', '/codemirror'
}

I'd expect you want this:

paths:  {
      'codemirror': '/codemirror'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM