Search code examples
javascriptrequirejsace-editor

Require.js ace editor script errors


I am doing the following:

<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");
    });
});

It seems to work fine, I see the ace editor with syntax highlighting.

However when I look in the javascript error log I see lots of entries like this...

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

etc..

Can someone please point out where I am going wrong (I am pretty new to require.js)?


Solution

  • Looks like you are using packed version, and this is a known bug https://github.com/ajaxorg/ace-builds/issues/35 caused by wrong order of define calls from https://groups.google.com/d/msg/ace-discuss/w6WlAmR0SH4/6tdtlMhnY40J seems like it should be fixed soon.