yuanqing / create-figma-plugin

:battery: The comprehensive toolkit for developing plugins and widgets for Figma and FigJam
https://yuanqing.github.io/create-figma-plugin/
MIT License
902 stars 85 forks source link

Error: widget missing call to figma.widget.register #217

Closed centigrade-julian-lang closed 3 months ago

centigrade-julian-lang commented 6 months ago

Hi!

I tried getting started with create-figma-plugin but have troubles getting it to work. My goal is it to create a figma widget, rather than a plugin.

These were my steps:

  1. As suggested here, I typed npx --yes create-figma-plugin in my terminal and ran it
  2. I chose the "resizable preact" template and hit enter
  3. I edited the manifest, it looks as follows:

manifest.json

{
"widgetApi": "1.0.0",
"api": "1.0.0",
"editorType": ["figma", "figjam"],
"containsWidget": true,
"id": "preact-resizable",
"name": "Preact Resizable",
"main": "build/main.js",
"ui": "build/ui.js"
}
  1. Then I built the project and went into figma and added this manifest as development-widget.
  2. Once done, figma complains about this error: "Error: widget missing call to figma.widget.register"

Inspecting the generated build/ui.js and build/main.js files I indeed cannot find this call in there. Manually adding the line figma.widget.register(Plugin) to the end of the ui.tsx file didn't help.

Am I doing something wrong? Thanks for your help!

yuanqing commented 6 months ago

Have you tried the widget/notepad template?

centigrade-julian-lang commented 5 months ago

@yuanqing No not yet, thanks for the suggestion! I will try it out and report back as soon as possible! 😊