Get a daily random issue suggestion from any GitHub repository
Refs: #1330, #1384 <!-- related PRs/discussions about Nuxt 4 tsconfig detection -->
Explain
Nuxt 4 defaults to the app/
directory and commonly uses a root tsconfig.json
with project references only.
The shadcn-vue CLI validates TS path aliases from tsconfig.json/jsconfig.json
, so without explicit compilerOptions.paths
, users can hit βNo import alias foundβ.
Also, pointing componentDir
at ./components/ui
(Nuxt 3 style) can confuse Nuxt 4 users whose components live under app/components/ui
.
What this PR changes
tsconfig.json (aliases)
section (before nuxt.config.ts
) showing explicit compilerOptions.paths
:
@/*
and ~/*
mapped to project root.@/components/*
β ./app/components/*
(Nuxt 4).nuxt.config.ts
, setshadcn.componentDir = './app/components/ui'
for Nuxt 4.nuxi prepare
(or mention mkdir -p app/components/ui
) to avoid the βComponent directory does not exist β¦/components/uiβ warning.Why
Ensures init
/add
pass alias validation and avoids confusing warnings for Nuxt 4 users.
Forward-compatible with ongoing work to auto-detect tsconfig for Nuxt (#1330, #1384).
Tested
npx shadcn-vue@latest init
β
npx shadcn-vue@latest add button
β
npx nuxi prepare
β no warnings β
N/A (docs-only)