You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when adding a new components for example npx shadcn@latest add button. usually the components importing the generated "utils" file, however, i rename the file to "cn.ts" and move it from ~/lib/utils to ~/lib/utils/cn. I also change the generated components.json file and refer the moved utils file to correct path.
What exactly is going wrong? Is the CLI not picking up your new utils file path?
Yes, sorry for not replying as soon as possible, the button component is importing the utils.ts file from ~/lib/utils not cn.ts file from ~lib/utils/cn.
Expected Output:
...
import{cn}from"~/lib/utils/cn";// the rest of button component
Intead of :
...
import{cn}from"~/lib/utils";// the rest of button component
Describe the bug
when adding a new components for example
npx shadcn@latest add button
. usually the components importing the generated "utils" file, however, i rename the file to "cn.ts" and move it from~/lib/utils
to~/lib/utils/cn
. I also change the generatedcomponents.json
file and refer the moved utils file to correct path.here's my
components.json
file:also my
tsconfig.json
file (i'm not changing anything):I do the same thing when working with Nextjs project, and everything works fine, but in Remix, this happened.
Affected component/components
Probably all components, but i only try it on Button, Label, and Form
How to reproduce
lib
folder namedutils
utils.ts
to insideutils
folderutils.ts
intocn.ts
components.json
, replace"utils": "~/lib/utils",
to"utils": "~/lib/utils/cn",
npx shadcn@latest add button
button.ts
cannot find module ~/lib/utils
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
Before submitting
The text was updated successfully, but these errors were encountered: