figma / ai-plugin-template

An example of making a Figma plugin that talks to OpenAI GPT models.
MIT License
92 stars 17 forks source link

How we can access third party helper lib inside FigmaPluginAPI #6

Open adarsh-technocrat opened 7 months ago

adarsh-technocrat commented 7 months ago

I want to use third party lib inside figmaAPI if i try to access it throws me below error

figmaAPI.ts:60 Uncaught (in promise) Error: _figma_plugin_helpers__WEBPACK_IMPORTED_MODULE_6__ is not defined
    at cb (webpack-internal:///(localhost:3000/app-pages-browser)/./lib/figmaAPI.ts:52:32)
cb  @   figmaAPI.ts:60

My Code Sample


   import { nodeToObject } from "@figma-plugin/helpers";

   <Button
        onClick={() => {
          figmaAPI.run(async (figma) => {
            const node = figma.currentPage.selection[0];
            const json = nodeToObject(node);
            console.log(json);
          });
        }}
      >
        Action
      </Button>

Is there is any way i can use this helper functions inside plugin

Thanks :)