code-connect icon indicating copy to clipboard operation
code-connect copied to clipboard

`imports` property seems to have stopped working as intended, could you confirm?

Open renandf opened this issue 10 months ago • 1 comments

TL;DR

imports doesn't seem to override the import statements anymore, and it's simply added together with the other import statements.

Context

A few weeks ago I connected some components between Figma and our design system via Code Connect. I've used imports to override the import statement as mentioned on issue #16, and it was working fine until recently. For example, I had the following code:

figma.connect(BcButton, '<FIGMA_BUTTONS>', {
  imports: ["import { BcButton, BcIcons } from '@bugcrowd/bc-elements'"],
  variant: {...},
  props: ...,
  example (...) => (...)
})

As expected, inside Code Connect, the only import statement present was:

import { BcButton, BcIcons } from '@bugcrowd/bc-elements'

However, last week I noticed all components were now showing multiple import statements. It seems the property used inside imports is simply being added to the list instead of overriding all of them.

Examples

Here are a couple of examples containing the example section in code and the Code Connect in Dev Mode.

Button example

The Button was working fine and I haven't touched it in the past few days. I published all Code Connect components when I was adding a new one (Modal below), and then realised the "imports issue." When I checked the button and all other components, they had the same issue.

Image Image
Modal example

This was the "new" component that made me realise the issue. When I published it using npx figma connect publish, which published all other components with it, I noticed the unwanted import statements. I went to check the other ones, and all of them had the same issue.

Image Image

Bug or intended behaviour?

Am I right in assuming this is not the intended behaviour and it's likely a bug? If it is a bug, can someone else see it too on their side, or should I raise a support ticket to investigate my case individually?

I don't know exactly when the issue started. I realised when testing the new component, but it could be there beforehand.

[!IMPORTANT] It was working fine in all (4~6) components before. The issue started after I published everything together, and even those components that were working and I didn't touch, got the issue


  • Code Connect CLI version: 1.3.1
  • Operating system: macOS Sequoia 15.3.1

renandf avatar Feb 24 '25 07:02 renandf

Hey @renandf! Thanks for the report, this is a longstanding bug around imports for nested instances that we shipped a fix for a few weeks ago which we had to revert, likely when you started seeing the issue. We are tracking this issue and hope to have proper fix for it soon.

slees-figma avatar Feb 25 '25 11:02 slees-figma