I'm trying to integrate XText to Ace web editor into my Angular 9 application.
According to XText documentation - It needs few AMD modules to be used on a client side.
As I see - it can be easily loaded with requireJS:
require.config({
paths: {
"jquery": "webjars/jquery/<version>/jquery.min",
"ace/ext/language_tools": "webjars/ace/<version>/src/ext-language_tools",
"xtext/xtext-ace": "xtext/<version>/xtext-ace"
}
});
require(["webjars/ace/<version>/src/ace"], function() {
require(["xtext/xtext-ace"], function(xtext) {
xtext.createEditor();
});
});
I installed ace from NPM, and copied proper JS files from xtext soruces to my assets folder.
And at this point, I'm a bit confused, how to make things work together.
I tried to import modules as described here, but 'xtext/xtext-ace' module isn't working in this way because of missing dependencies, which are defined in ace module. When I trying to import ace js file - console is filled by errors about missing dependencies (which are actually defined in itself)
ERROR in ./src/assets/scripts/ace.js
Module not found: Error: Can't resolve '../../lib/lang'
ERROR in ./src/assets/scripts/ace.js
Module not found: Error: Can't resolve '../../lib/oop'
ERROR in ./src/assets/scripts/ace.js
Module not found: Error: Can't resolve '../../range'
How should I import this modules to make them work in proper way in Angular component typescript files?
UPD: Uploaded simple angular application to github for example.
I added both modules js files to './src/assets/scripts'
folder and trying to access it in app.component.ts
When I tried to import it with help or requirejs in index.html
it was working, but I need it to work in my component.ts files, and get confused, how to redo this imports in them.