Open ravenkim opened 1 month ago
@ravenkim is this a new vite project with react?
@shadcn i got two project in new one and old one have same problem
with react vite
in recent project , when i pull new component
everything works well except
cn path
every {cn} path in new components looks like
import { cn } from "s/lib/utils"
it worked well before like
import { cn } from "src/assets/shadcn/utils"
i have utils in aliases
"aliases": {
"components": "./src/assets/shadcn/components",
"utils": "./src/assets/shadcn/utils"
}
i tried to put these but it doesnt work
"aliases": {
"components": "./src/assets/shadcn/components",
"utils": "./src/assets/shadcn/lib/utils",
"ui": "./src/assets/shadcn/components/ui",
"lib": "./src/assets/shadcn/lib",
"hooks": "./src/assets/shadcn/hooks"
}
resolve: {
alias: {
src: path.resolve(__dirname, 'src'),
},
},
jsconfig.json
{
"compilerOptions": {
"jsx": "react-jsx",
"target": "ES6",
"module": "commonjs",
"baseUrl": "./",
"paths": {
"src/*": ["src/*"]
},
"allowJs": true,
"checkJs": false,
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
to
{
"files": [],
"references": [
{
"path": "./jsconfig.app.json"
},
{
"path": "./jsconfig.node.json"
}
],
"compilerOptions": {
"jsx": "react-jsx",
"target": "ES6",
"module": "commonjs",
"baseUrl": ".",
"paths": {
"./src/*": ["./src/*"]
},
"allowJs": true,
"checkJs": false
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"./src/*": [
"./src/*"
]
}
},
"include": [
"src"
]
}
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import path from "path"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
src: path.resolve(__dirname, 'src'),
},
},
})
Describe the bug
when I init
✔ Preflight checks. ✔ Verifying framework. Found Vite. ✔ Validating Tailwind CSS. ✔ Validating import alias.
Something went wrong. Please check the error below for more details. If the problem persists, please open an issue on GitHub.
Validation failed:
Affected component/components
init
How to reproduce
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
Before submitting