'Event to capture when monaco editor requires a dependency

I am working on a custom editor and I want to load dependencies on demand. For example, suppose I can the next code:

import * as React from "react";
import {Auth} from "@testing/login/home/bridge";
import {routing} from "@routing/kernel/routing/ts";

interface IForm {
    disabled?: boolean;
}

The common way to load dependencies is by addExtraLib method but is necessary to have loaded the files. What I need to do is capture an event to know when Monaco requires dependencies and load these at that moment.

There is a way to do that? I searched on Monaco documentation but I didn't find it. The reason Why I need to do it is that a source could have a lot of dependencies and charge all before could generate performance issues.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source