Error codesComponents

Two files render each other

MARKLESS_COMPONENT_IMPORT_CYCLEerrorMarkless raises it while Vite builds or serves your app.

The message

MARKLESS_COMPONENT_IMPORT_CYCLE: These files render each other's components: <cycle>. Each file is compiled against what the files it renders publish, and files that render each other cannot both publish first. Put the components that render each other in one .tsrx file, where a component may render itself or another component of that file at any depth; one that holds @try has to be the file's default export.

Words in angle brackets change from case to case.

Why

Markless compiles each file against what the files it renders publish once they are compiled. When files render each other, like a comment that renders its replies from another file and replies that render comments, neither can finish first, so the build stops instead of waiting forever.

Fix

Move the components that render each other into one .tsrx file. Inside one file a component can render itself, or another component of the same file, at any depth. A component that holds @try has to be that file's default export.

export default function Comment({ item }) @{	<div>{item.text}<Replies items={item.replies} /></div>}export function Replies({ items }) @{	<ul>		@for (const reply of items; key reply.id) {			<li><Comment item={reply} /></li>		}	</ul>}
Where Markless raises it

All error codes