The main suggested solution for using external resources is using the embedding method described in the webpack section. Alternatively to this, you can link to external resources. However this comes with several constraints:
You have to use absolute URLs starting with
https:// and host the resources on your own server. It is currently not possible to ship other resources with the plugin and link to them. To ship additional resources they have to be embedded.
It is only possible to link to external resources from within the
<iframe> created using
Using external resources likely means that the plugin will not work if the user is offline when they run the plugin. The Figma editor currently is able maintain limited functionality and run plugins even if the user loses connectivity after having opened the editor. However if the plugin tries to load external resources, accessing those will likely require connectivity.
In order to link to external resources from within the
<iframe>, use normal put normal HTML markup in your UI, such as
<link href="..." rel="stylesheet"> or
<script src="..."></script>. However you have to use absolute URLs starting with
https:// and host the resources on a server reachable by the plugin user.
XMLHttpRequest to load a script from the network inside the
<iframe>, send the script to the main thread using
postMessage, and then
eval() the string.