React Import third party cdn scripts in Panel plugin

I am trying to import third party libraries to work with it in order to avoid static linking of third party modules. Is it even possible in current react implementation.

Because i do not see a index.html file in current react setup to develop plugins. Previously we had module.html . Do we have something like that in react to develop the plugin?

Basically i do not want to use npm and yarn for static linkage .

Any help or idea is highly appreciated.

Hello @kmvijayraghunath

May be this can be achieved with componentDidMount method:

componentDidMount () {
    const script = document.createElement("script");
    script.src = "CDN_URL.js";
    script.async = true;
    document.body.appendChild(script);
}

Regards,
V.

Thanks for the reply… yes this method attach the script to index.html, but for some reason I am not able to access the script variable in the window object …
Example: window.my_script_exported_variable.

However, this object is available in chrome dev tools when I try to fetch from window object.

Meaning plugin module.js is loading before the scripts in network tab .

Any other suggestions are highly appreciated :blush: