【问题标题】:Require.js ace editor script errorsRequire.js ace 编辑器脚本错误
【发布时间】:2014-06-23 14:52:01
【问题描述】:

我正在做以下事情:

<script src="/js/lib/require.js" data-main="/js/app"></script>

app.js

requirejs.config({
    "baseUrl": "/js/lib",
    "paths": {
        "app": "../app",
        "jquery": "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min",
        "ace": "ace"
    }
});

// Load the main app module to start the app
requirejs(["app/main"]);

main.js

define(["jquery", "ace/ace"], function($, ace){

    $(document).ready(function(){
        var editor = ace.edit("editor-ace");
        editor.getSession().setMode("ace/mode/html");
    });
});

它似乎工作正常,我看到带有语法突出显示的 ace 编辑器。

但是,当我查看 javascript 错误日志时,我看到很多这样的条目...

Script error for: ace/edit_session
Script error for: ace/undomanager

等等。

谁能指出我哪里出错了(我对require.js很陌生)?

【问题讨论】:

    标签: javascript requirejs ace-editor


    【解决方案1】:

    看起来您使用的是打包版本,这是一个已知的错误https://github.com/ajaxorg/ace-builds/issues/35,由来自https://groups.google.com/d/msg/ace-discuss/w6WlAmR0SH4/6tdtlMhnY40J 的定义调用顺序错误引起,看来应该尽快修复。

    【讨论】:

      猜你喜欢
      • 2015-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-20
      • 2015-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多