Path alias imports not being resolved in Figma Code Connect
Problem
Path aliases (@/*) in .figma.tsx files are not being transformed to the public package name. Relative imports work, but alias imports don't.
Current output:
"imports": [
"import Alert from '@acme/package/Alert';", // ✅ relative import works
"import AlertTitle from '@/AlertTitle';" // ❌ alias import doesn't work
]
Expected output:
"imports": [
"import Alert from '@acme/package/Alert';",
"import AlertTitle from '@acme/package/AlertTitle';"
]
Setup
Alert.figma.tsx:
import Alert from './Alert'; // Works
import AlertTitle from '@/AlertTitle'; // Doesn't work
tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"paths": { "@/*": ["./src/*"] }
}
}
figma.config.json:
{
"codeConnect": {
"include": ["src/**/*"],
"parser": "react",
"importPaths": { "*": "@acme/package" },
"paths": { "@/*": ["src/*"] }
}
}
Configurations Tried
None of these work:
"importPaths": { "*": "@acme/package" }"importPaths": { "*": "@acme/package/*" }"importPaths": { "@/*": "@acme/package/*" }- Multiple combinations of the above with different
pathsconfigurations
Question
What's the correct figma.config.json setup to transform path aliases that match tsconfig.json?
Environment
- Node: v22.15.0
- @figma/code-connect: v1.3.6
- OS: macOS
Hi @jorgemasta. Thanks for the report. We'll investigate and see what we can improve here.
@jorgemasta this should be fixed now in version 1.3.6 of the CLI. Could you please check if that's the case? Thanks!
@ptomas-figma We were already using 1.3.6. I tried the new 1.3.7 version, and there are some improvements, but there's a remaining issue.
Now it's generating these imports (with the connect parse command):
"imports": [
"import Alert from '@acme/package/Alert';",
"import AlertTitle from '@acme/package/index';"
],
Then, in Figma, we have:
import Alert from "@acme/package/Alert"
import AlertTitle from "@acme/package/index"
import AlertTitle from "@acme/package/AlertTitle"
import Button from "@acme/package/Button"
In Figma, it's almost correct since we have import AlertTitle from "@acme/package/AlertTitle", but import AlertTitle from "@acme/package/index" should not appear.