Adding modules to monaco editor


I'm trying to add modules to my Monaco editor but I don't know how to access to the monaco instance for doing that.

This is what I'm trying to do right now:

that.initEditor = () => {
        that.editor = RED.editor.createEditor({
          id: 'script-editor',
          mode: 'typescript',
          value: that.oldValue,
          fontLigatures: true

       //now I want to change properties in my editor
 if(that.editor && that.editor.type === "monaco"){
         const tsDefaults = monaco.languages.typescript.typescriptDefaults;
        functionsDeclaration.forEach(fd =>
                  typeModels.push(tsDefaults.addExtraLib(fd.content, fd.filename))

I also want to configure my diagnostics options via: tsDefaults.setDiagnosticsOptions({}).

Can you help me, please?

Thank you!

If it is for across your whole NR instance, then you can simply set those in settings.js file under

    editorTheme: {
        codeEditor: {
            monaco: {
                languages: {
                     typescript: {
                        typescriptDefaults: {

You should not be specifying things like this in your custom node. these kind of settings are personal to a user and should be user determined by the options object in settings.js or the users installed theme.

As for adding modules to monaco editor, this is not something yet formalised or implemented in the core as an exposed API. You could look at the node-red source and see if you can support this for the up-coming Node-RED v4 release (now is the time to add this kind of support)

Hi, thanks for your answer.

I need this configuration for my custom node exclusively and for me, the important thing is to achieve adding modules. Having the editor instance, it is possible to access to the monaco instance?

Thanks for your answer