RequireJS optimized version of ace missing some files #1068

Closed
zubairov opened this Issue Oct 25, 2012 · 8 comments

4 participants

@zubairov

I have a simple require JS optimizer running with ace sources. It works ok and for my use-case (default theme and JavaScript editor mode) I have following dependency tree:

js/modules/ace.js
       ----------------
       js/modules/ace/lib/regexp.js
       js/modules/ace/lib/es5-shim.js
       js/modules/ace/lib/fixoldbrowsers.js
       js/modules/ace/lib/dom.js
       js/modules/ace/lib/oop.js
       js/modules/ace/lib/keys.js
       js/modules/ace/lib/useragent.js
       js/modules/ace/lib/event.js
       js/modules/ace/lib/lang.js
       js/modules/ace/keyboard/textinput.js
       js/modules/ace/mouse/default_handlers.js
       js/modules/ace/mouse/default_gutter_handler.js
       js/modules/ace/mouse/mouse_event.js
       js/modules/ace/mouse/dragdrop.js
       js/modules/ace/mouse/mouse_handler.js
       js/modules/ace/mouse/fold_handler.js
       js/modules/ace/keyboard/keybinding.js
       js/modules/ace/config.js
       js/modules/ace/lib/net.js
       js/modules/ace/lib/event_emitter.js
       js/modules/ace/range.js
       js/modules/ace/selection.js
       js/modules/ace/tokenizer.js
       js/modules/ace/mode/text_highlight_rules.js
       js/modules/ace/mode/behaviour.js
       js/modules/ace/unicode.js
       js/modules/ace/mode/text.js
       js/modules/ace/anchor.js
       js/modules/ace/document.js
       js/modules/ace/background_tokenizer.js
       js/modules/ace/search_highlight.js
       js/modules/ace/edit_session/fold_line.js
       js/modules/ace/edit_session/fold.js
       js/modules/ace/token_iterator.js
       js/modules/ace/edit_session/folding.js
       js/modules/ace/edit_session/bracket_match.js
       js/modules/ace/edit_session.js
       js/modules/ace/search.js
       js/modules/ace/keyboard/hash_handler.js
       js/modules/ace/commands/command_manager.js
       js/modules/ace/commands/default_commands.js
       js/modules/ace/editor.js
       js/modules/ace/undomanager.js
       js/modules/ace/layer/gutter.js
       js/modules/ace/layer/marker.js
       js/modules/ace/layer/text.js
       js/modules/ace/layer/cursor.js
       js/modules/ace/scrollbar.js
       js/modules/ace/renderloop.js
       js/modules/ace/requirejs/text.js
       modules/ace/requirejs/text!modules/ace/css/editor.css
       js/modules/ace/virtual_renderer.js
       js/modules/ace/range_list.js
       js/modules/ace/mouse/multi_select_handler.js
       js/modules/ace/commands/multi_select_commands.js
       js/modules/ace/multi_select.js
       js/modules/ace/worker/worker_client.js
       js/modules/ace/placeholder.js
       js/modules/ace/mode/folding/fold_mode.js
       modules/ace/requirejs/text!modules/ace/theme/textmate.css
       js/modules/ace/theme/textmate.js
       js/modules/ace/ace.js
       js/modules/ace/mode/doc_comment_highlight_rules.js
       js/modules/ace/mode/javascript_highlight_rules.js
       js/modules/ace/mode/matching_brace_outdent.js
       js/modules/ace/mode/behaviour/cstyle.js
       js/modules/ace/mode/folding/cstyle.js
       js/modules/ace/mode/javascript.js
       js/modules/ace.js

Where js/modules/ace.js is my entrance point. However when I start using optimized ace in browser (Chrome) I see following two files are still tried to be dynamically loaded:

js/modules/ace/worker/worker.js
s/modules/ace/lib/fixoldbrowsers.js

Do you know what I did wrong, and what does the worker.js do? (I looked inside and it seems it's some re-definition of requirejs functions?)

@nightwing
Ajax.org B.V. member

these files are used in webWorker and can't be combined with other files.
one can keep them as text and use data url to create the worker, but letting ace to load them separately is better

@zubairov

So, what do I need to do to integrate ace into my requirejs optimization build? Right now it obviously does not work correctly as not all files are included in the optimized version?

@nightwing
Ajax.org B.V. member

probably easiest way is to keep ace/build as well

and add the following snippet in optimized version

config = require("ace/config")
config.set("packaged",true)

var path = "js/modules/ace/build/src-min"
config.set("workerPath", path)
config.set("modePath", path)
config.set("themePath", path) //i'll add basePath setting to make this shorter

this way, core files will be loaded with main app
and the rest will be loaded only when needed.

note that due to crossorigin restrictions on workers workers must be served from the same domain

@bootstraponline

It'd be nice to have official documentation for using Ace + RequireJS Optimizer.

@bootstraponline bootstraponline referenced this issue in gollum/gollum Oct 29, 2012
Open

Update to optimized Ace v1.0 #526

@nightwing
Ajax.org B.V. member

@zubairov @bootstraponline should i close this issue?

@bootstraponline

@nightwing I think so. The documentation on the wiki should solve the problem.

@gjtorikian gjtorikian closed this Dec 6, 2012
@zubairov

Sorry for late reply, fine with me. I didn't had time to try solution yet, thanks for documenting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment