From 3199abb4e6f114ddefb18b53dce5401a038afe49 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Thu, 5 Mar 2026 09:19:15 +0300 Subject: [PATCH] Fix render tool on Windows: add .js extension to dynamic imports ESM dynamic imports require explicit file extensions for resolution on Windows + Bun. The extensionless '../render/render-jsx' path worked on macOS/Linux but failed on Windows with 'Cannot find module' error. Fixes #43 --- packages/core/src/tools/schema.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/tools/schema.ts b/packages/core/src/tools/schema.ts index 2d03afe5c..f2e8024ff 100644 --- a/packages/core/src/tools/schema.ts +++ b/packages/core/src/tools/schema.ts @@ -193,7 +193,7 @@ export const render = defineTool({ parent_id: { type: 'string', description: 'Parent node ID to render into' } }, execute: async (figma, args) => { - const { renderJsx } = await import('../render/render-jsx') + const { renderJsx } = await import('../render/render-jsx.js') const result = await renderJsx(figma.graph, args.jsx, { parentId: args.parent_id ?? figma.currentPageId, x: args.x, @@ -1046,7 +1046,7 @@ export const nodeReplaceWith = defineTool({ const x = node.x const y = node.y node.remove() - const { renderJsx } = await import('../render/render-jsx') + const { renderJsx } = await import('../render/render-jsx.js') const result = await renderJsx(figma.graph, args.jsx, { parentId, x, y }) return { id: result.id, name: result.name, type: result.type } }