[bug]: Custom utils path inside `components.json` is being ignored
Describe the bug
Here's my components.json file:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/styles/globals.css",
"baseColor": "gray",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "~/shared/components",
"utils": "~/shared/lib",
"ui": "~/shared/ui-kit",
"lib": "~/shared/lib",
"hooks": "~/shared/hooks"
}
}
However, when adding component cn is always being imported from ~/lib/utils even though I explicitly specified it from ~/shared/lib.
Affected component/components
Every
How to reproduce
- Modify your
components.jsonto match mine. - Try to add a component, for example
npx shadcn@latest add sidebar
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
[email protected], [email protected], [email protected]
Before submitting
- [X] I've made research efforts and searched the documentation
- [X] I've searched for existing issues
I thought I was not configuring properly, seems like that isn't the case. Happy to know I'm not the only one 😂
I ran into this myself and wrote up a fix for it here https://github.com/shadcn-ui/ui/pull/5616
If anyone wants to try my fix I published it to my own npm registry
Just run npx -y https://verdaccio.tobbe.dev/shadcn/-/shadcn-2.1.2-tobbe-20241029-0244.tgz add button or whatever component you want to try with :)
This is still not working
Same here. components.json is being ignored.
Also broken for me.