Update codes in a plug-in file

Hi everyone,

I followed the exact steps in this Figma tutorial to create a plugin on my own. I made changes to the “code.ts” file, but my plugin didn’t update the effects.

The details: I made changes to the “code.ts” file by replacing “Figma.createRectangle()” with “Figma.createEllipse()”. I relaunched the plugin on Figma, but the plugin still created rectangles rather than ellipses.

If I made the same change to the “code.js” file, I was able to update the plugin effects.

I have tried the following:

  • Restart my desktop, relaunch vs code, relaunch Figma
  • Ensure that I Install everything as required: vs code, node.js, npm, TypeScript, typings, (and verify all installation)
  • Select “Select Command Prompt” under “terminal select default profile”
  • Select “tsc:watch-tsconfig.json.”

Just reporting that I’m having the same issue. I’m updating a plugin and the watch command isn’t doing the automatic updating of the .js file. I usually have to force a change to the config file or some other brute force hackery (e.g. force a tsc error loop on code.ts) to get the .js file to update.

This is more likely an issue with VS Code rather than Figma, but I’m checking here if anyone has seen a similar issue and figured out how to resolve it.

1 Like

Same here. Did you find any solution for it?

Hi there, Thanks for reaching out about this!

While we are waiting for the input from our community, I will also reach out to our internal team that we have any information for this.

We are always open to hearing different ideas or perspectives from our community members on this matter. Please don’t hesitate to share your thoughts here.

Thanks again for reaching out.

Hi, when you update “code.tsx” it does not automatically update “code.js”, which is needed to run the plugin or widget. I assume you’ve followed the setup guide and created a build. To ensure “code.js” updates automatically when you make changes to “code.tsx” , you’ll need to run “npm run watch” in your project directory via your CLI.

Hope it helps :crossed_fingers: