requirejs baseUrl并在ace.js中要求(" ./ ...)

时间:2014-09-04 11:55:59

标签: javascript requirejs ace-editor

我使用requirejs(2.1.14)和ace.js与此配置:

require.config({
    baseUrl: 'myPath',
    paths: {
        ...
        ace: 'vendor/ace/lib/ace/ace',
        ...
    }
});

require([
'jquery','domReady','allbootstrap','ace'
], function($, domReady) {
    domReady(function () {
        var editor = ace.edit("editor");
        ...
    })
);

ace.js(在bundle / myapps / vendor / ace / lib / ace / ace.js中)被很好地调用。但是ace.js的开头是:

define(function(require, exports, module) {
"use strict";
require("./lib/fixoldbrowsers");
var dom = require("./lib/dom");
...

但是要求找不到fixoldbrowsers.js。它看起来:

束/安装MyApps / LIB / fixoldbrowsers.js

但我的档案在:

束/安装MyApps /供应商/ ACE / LIB / ACE / LIB / fixoldbrowsers.js

1 个答案:

答案 0 :(得分:1)

感谢nightwing(https://github.com/ajaxorg/ace/issues/1690

require.config({
  baseUrl: 'myPath',
  paths: {
    ...
    ace: 'vendor/ace/lib/ace',
    ...
  }
});
require(['jquery','domReady','ace/ace','allbootstrap'], 
  function($, domReady, ace) {
    domReady(function () {
      var editor = ace.edit("editor");
      ...
    })
);