shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
72.95k stars 4.45k forks source link

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

Open dx1ded opened 2 days ago

dx1ded commented 2 days ago

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

Node@20.18.0, React@19.0.0-rc-69d4b800-20241021, NextJS@15.0.1

Before submitting

its-me-sv commented 2 days ago

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