Skip to content

[Bug]: Custom Path Aliases not working in Nuxt project #1202

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

Open
2 tasks
gyenabubakar opened this issue Apr 23, 2025 · 1 comment
Open
2 tasks

[Bug]: Custom Path Aliases not working in Nuxt project #1202

gyenabubakar opened this issue Apr 23, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@gyenabubakar
Copy link

Reproduction

https://github.com/gyenabubakar/repro-shadcn-nuxt-aliases-not-working

Describe the bug

In the reproduction repo, you will see that I have a minimal Nuxt project which configures a path alias: shadcn -> ./_shadcn.

In the components.json file, the path aliases have been configured this way:

{
    "ui": "shadcn",
    "components": "shadcn/components",
    "composables": "shadcn/_composables",
    "lib": "shadcn/_lib",
    "utils": "shadcn/utils"
  }

And the nuxt.config.ts file reflects this intent too. Note that, I moved the utils.ts file into the _shadcn directory.

The Bug

When I attempt to add the Button component:

npx shadcn-vue@latest add button

...this is what happens:

# ...installation logs

? The folder _shadcn already exists. Would you like to overwrite? › (y/N)

Pressing the Y key creates _shadcn/Button.vue and _shadcn/index.ts files. These files are supposed to be in _shadcn/button directory.

System Info

System:
    OS: macOS 15.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 158.45 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.22 - ~/.yarn/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 9.7.1 - /opt/homebrew/bin/pnpm
    bun: 1.2.2 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 135.1.77.100
    Chrome: 135.0.7049.96
    Safari: 18.4
  npmPackages:
    @vueuse/core: ^13.1.0 => 13.1.0 
    nuxt: ^3.16.2 => 3.16.2 
    shadcn-nuxt: ^2.1.0 => 2.1.0 
    vue: ^3.5.13 => 3.5.13

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests
@gyenabubakar gyenabubakar added the bug Something isn't working label Apr 23, 2025
@brokuka
Copy link

brokuka commented Apr 29, 2025

#1102

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
Development

No branches or pull requests

2 participants