Replies: 6 comments 1 reply
-
seeing the exact same thing, thanks for posting |
Beta Was this translation helpful? Give feedback.
-
Yup it happens to me too. +1 |
Beta Was this translation helpful? Give feedback.
-
Can confirm; I've tried a number of different things, with/without tsconfig paths etc -- it happens even if you don't define any path aliases in tsconfig. I can't really see why looking briefly at the code, but any alias with multiple forward-slashes except one using the word 'workspace' seems to just cut off before the first forward-slash. E.g.:
|
Beta Was this translation helpful? Give feedback.
-
Same exact issue here. Has it been fixed? |
Beta Was this translation helpful? Give feedback.
-
I tried using version 2.1.6 and it seems to work 🤔 at least for this case pnpm dlx [email protected] add [COMPONENT] canary and > 2.1.7 seem to be broken or do what zwarunek did |
Beta Was this translation helpful? Give feedback.
-
shadcn uses "paths": {
"@<your-package-name>/ui/*": ["./src/*"]
} then you can use it in "aliases": {
"components": "@<your-package-name>/ui/components",
"utils": "@<your-package-name>/ui/lib/utils",
} so when you run |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is about using a monorepo setup with new CLI.
Recently I was trying to use the new monorepo feature on the CLI with my existing next.js monorepo project. I have the name of the
packages/ui
package set as@mycompany/ui
. I found that changing@workspace
namespace to some other (for example,@mycompany
) would break importing the utils.For example, in the standard example, scattered by
bunx --bun shadcn@canary init
(as described here), adding , for instance,card
component:cd apps/web bunx --bun shadcn@canary add card
would scatter the
card.tsx
into thepackages/ui/src/components/card.tsx
file, no problems.But if change the
@worksapce
to something else throughout the code (@mycompany
for instance), and re-run the add CLI the import ofcn
in thecard.tsx
would become incorrect. It will becomeimport { cn } from "@mycompany/lib/utils"
instead of
import { cn } from "@mycompany/ui/lib/utils"
Changing
@mycompany
back to@workspace
would fix it back.import { cn } from "@workspace/ui/lib/utils"
Beta Was this translation helpful? Give feedback.
All reactions