react: [Bug]: Cannot find icon
Prerequisites
- I have searched existing issues to ensure this bug hasn’t been reported already
- I have tested this with the latest version of the components
Bug description
Error: Cannot find module '/XXX_REDACTED_XXX/node_modules/@untitledui/icons/dist/ActivityHeart' imported from /XXX_REDACTED_XXX/node_modules/@untitledui/icons/dist/index.mjs
I get the above error when implementing the following. I have followed the installation instructions closely
Steps to reproduce
- Install package
- Add the page snippet above
- Load page
Expected behavior
Expected there to be no runtime crash
Actual behavior
Runtime crash
Code example
import { useState } from "react"
import { TabList, Tabs } from "@/components/application/tabs/tabs"
import { Button } from "@/components/base/buttons/button"
import { SocialButton } from "@/components/base/buttons/social-button"
import { Form } from "@/components/base/form/form"
import { Input } from "@/components/base/input/input"
import { BackgroundPattern } from "@/components/shared-assets/background-patterns"
import { cx } from "@/utils/cx"
const tabs = [
{
id: "signup",
label: "Sign up",
},
{
id: "login",
label: "Log in",
},
]
export const SignupSimple = () => {
const [password, setPassword] = useState("")
return (
<section className="min-h-screen overflow-hidden bg-primary px-4 py-12 md:px-8 md:pt-24">
<div className="mx-auto flex w-full flex-col gap-8 sm:max-w-90">
<div className="flex flex-col items-center gap-6 text-center">
<div className="relative">
<BackgroundPattern
pattern="grid"
className="absolute top-1/2 left-1/2 z-0 hidden -translate-x-1/2 -translate-y-1/2 md:block"
/>
<BackgroundPattern
pattern="grid"
size="md"
className="absolute top-1/2 left-1/2 z-0 -translate-x-1/2 -translate-y-1/2 md:hidden"
/>
{/* <LogoMark size="lg" className="relative z-10 max-md:hidden" />
<LogoMark size="md" className="relative z-10 md:hidden" /> */}
</div>
<div className="z-10 flex flex-col gap-2 md:gap-3">
<h1 className="text-display-xs font-semibold text-primary md:text-display-sm">
Create an account
</h1>
<p className="text-md text-tertiary">
Start your 30-day free trial.
</p>
</div>
<Tabs className="z-10 w-full">
<TabList size="sm" fullwidth type="button-minimal" items={tabs} />
</Tabs>
</div>
<Form
onSubmit={(e) => {
e.preventDefault()
const data = Object.fromEntries(new FormData(e.currentTarget))
console.log("Form data:", data)
}}
className="z-10 flex flex-col gap-6"
>
<div className="flex flex-col gap-5">
<Input
isRequired
hideRequiredIndicator
label="Name"
type="text"
name="name"
placeholder="Enter your name"
size="md"
/>
<Input
isRequired
hideRequiredIndicator
label="Email"
type="email"
name="email"
placeholder="Enter your email"
size="md"
/>
<Input
isRequired
hideRequiredIndicator
label="Password"
type="password"
name="password"
size="md"
placeholder="Create a password"
onChange={setPassword}
minLength={8}
pattern='.*[!@#$%^&*(),.?\":{}|<>].*'
/>
<div className="flex flex-col gap-3">
<span className="flex gap-2">
<div
className={cx(
"flex size-5 items-center justify-center rounded-full bg-fg-disabled_subtle text-fg-white transition duration-150 ease-in-out",
password.length >= 8 ? "bg-fg-success-primary" : "",
)}
>
<svg width="10" height="8" viewBox="0 0 10 8" fill="none">
<path
d="M1.25 4L3.75 6.5L8.75 1.5"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</div>
<p className="text-sm text-tertiary">
Must be at least 8 characters
</p>
</span>
<span className="flex gap-2">
<div
className={cx(
"flex size-5 items-center justify-center rounded-full bg-fg-disabled_subtle text-fg-white transition duration-150 ease-in-out",
password.match(/[!@#$%^&*(),.?":{}|<>]/)
? "bg-fg-success-primary"
: "",
)}
>
<svg width="10" height="8" viewBox="0 0 10 8" fill="none">
<path
d="M1.25 4L3.75 6.5L8.75 1.5"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</div>
<p className="text-sm text-tertiary">
Must contain one special character
</p>
</span>
</div>
</div>
<div className="z-10 flex flex-col gap-4">
<Button type="submit" size="lg">
Get started
</Button>
<SocialButton social="google" theme="color">
Sign up with Google
</SocialButton>
</div>
</Form>
<div className="flex justify-center gap-1 text-center">
<span className="text-sm text-tertiary">
Already have an account?
</span>
<Button href="#" color="link-color" size="md">
Log in
</Button>
</div>
</div>
</section>
)
}
Browser
No response
Device type
No response
Component version
No response
Environment details
No response
Screenshots/Videos
No response
Console errors
Additional context
No response
Accessibility impact
- This bug affects keyboard navigation
- This bug affects screen reader users
- This bug affects focus management
- This bug affects color contrast or visual accessibility
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 26 (11 by maintainers)
I just pushed the
betachanges to thelatesttag. Please install the latest version:Thanks @jchonde for the feedback and suggestion 🙌 .
just tried it and it is still broken
Hi, I’m encountering the same issue in a Vite setup. In a strict ESM environment, file extensions must be explicitly specified.
In
node_modules/@untitledui/icons/dist/index.mjs, the line:import { ActivityHeart as e } from "./ActivityHeart";should be:import { ActivityHeart as e } from "./ActivityHeart.mjs";That should solve our issue.
@deebov
tsconfig.json:
eslint.config:
vitest.config.ts: