Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: Custom utils path inside components.json is being ignored #5544

Open
2 tasks done
dx1ded opened this issue Oct 24, 2024 · 3 comments · May be fixed by #5616 or #5976
Open
2 tasks done

[bug]: Custom utils path inside components.json is being ignored #5544

dx1ded opened this issue Oct 24, 2024 · 3 comments · May be fixed by #5616 or #5976
Labels
bug Something isn't working

Comments

@dx1ded
Copy link

dx1ded commented Oct 24, 2024

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

  1. Modify your components.json to match mine.
  2. Try to add a component, for example npx shadcn@latest add sidebar

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@dx1ded dx1ded added the bug Something isn't working label Oct 24, 2024
@its-me-sv
Copy link

I thought I was not configuring properly, seems like that isn't the case. Happy to know I'm not the only one 😂

@Tobbe Tobbe linked a pull request Oct 28, 2024 that will close this issue
@Tobbe
Copy link
Contributor

Tobbe commented Oct 28, 2024

I ran into this myself and wrote up a fix for it here #5616

@Tobbe
Copy link
Contributor

Tobbe commented Oct 29, 2024

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants