Open hieu26122004 opened 1 month ago
I am using create react app and encountering the above error: Module not found: Error: Can't resolve '@/lib/utils' The above doesn't happen if I write the following "../../lib/utils"
// tsconfig.json { "compilerOptions": { "target": "ES2020", "useDefineForClassFields": true, "lib": ["ES2020", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, "baseUrl": ".", "paths": { "@/": ["./src/"] }, "moduleResolution": "bundler", "allowImportingTsExtensions": true, "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, "include": ["src"] }
//components.jsons { "$schema": "https://ui.shadcn.com/schema.json", "style": "new-york", "rsc": true, "tsx": true, "tailwind": { "config": "tailwind.config.js", "css": "src/index.css", "baseColor": "slate", "cssVariables": true, "prefix": "" }, "aliases": { "components": "@/components", "utils": "@/lib/utils" } }
Button,...
npx shadcn-ui@0.8.0 init
shadcn@latest add button
npm start
No response
Create React App
file structure:
you can try out this, if it will work,
{ "compilerOptions": { "baseUrl": "src", "paths": { "@/": ["./src/"] } } }
@hieu23143242
Describe the bug
I am using create react app and encountering the above error: Module not found: Error: Can't resolve '@/lib/utils' The above doesn't happen if I write the following "../../lib/utils"
// tsconfig.json { "compilerOptions": { "target": "ES2020", "useDefineForClassFields": true, "lib": ["ES2020", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, "baseUrl": ".", "paths": { "@/": ["./src/"] }, "moduleResolution": "bundler", "allowImportingTsExtensions": true, "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, "include": ["src"] }
//components.jsons { "$schema": "https://ui.shadcn.com/schema.json", "style": "new-york", "rsc": true, "tsx": true, "tailwind": { "config": "tailwind.config.js", "css": "src/index.css", "baseColor": "slate", "cssVariables": true, "prefix": "" }, "aliases": { "components": "@/components", "utils": "@/lib/utils" } }
Affected component/components
Button,...
How to reproduce
npx shadcn-ui@0.8.0 init
shadcn@latest add button
npm start
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
Before submitting