Skip to content

Select component imports HoverCard internally, causing SSR crash when HoverCard is not included #2263

@tariknh

Description

@tariknh

Describe the bug

When removing a component that is not being used anymore, i get this error. I think it might be coming from the import * as HoverCard.

Reproduction

When using the Select component in SvelteKit (Svelte 5 runes), the build/runtime fails during SSR if src/lib/components/ui/hover-card is removed — even if HoverCard is never used in my code.

The error looks like:

Cannot read properties of undefined (reading 'Root')

and points to:

const Root = HoverCardPrimitive.Root;

Logs

ERROR TypeError: Cannot read properties of undefined (reading 'Root')

System Info

ERROR TypeError: Cannot read properties of undefined (reading 'Root')

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageThe issue is pending triage by a maintainer.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions