Iframe & External styles in figma plugin development

Hi everyone,
I’m following the official Figma plugin development videos. I have two questions

  1. Why does any external stylesheet, whether it’s a CDN link or I install a package through NPM and try to use it, not work? For CDN links, I keep getting Content Security Policy (CSP) errors, the same as on iframes.

  2. Can we even use iframes in the Figma plugin? My plugin role would be to export the Figma screens to my site.

If you need any more information please ask, thanks for any help i may get

Hi, there’s an allowlist of domains that the plugin can access that you’ll need to update in manifest.json: Making Network Requests | Plugin API

Once you add the correct domains to the manifest, the CSP errors should go away.

1 Like

Thanks for the reply @James_Yang , I have sorted CSP errors thanks to your help much appreciated. Do you have any idea why the local imports of .css files are not working?

Imports are dependent on your build configuration, so there’s not much I can do there. Figma just expects that all of your iframe code be bundled into a single file.

Alright, I read someone’s comment, that the only way to use CSS is to do it on the UI file or use the external link like how we solved the CSP issue all external files should be alright for CSS.