nezamy
nezamy
WWasp-lang
Created by nezamy on 7/28/2024 in #đŸ™‹questions
tsconfig paths alias
Hello, I added paths in tsconfig.json on the app like this
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@ui/*": ["./src/client/components/ui/*"],
}
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@ui/*": ["./src/client/components/ui/*"],
}
and in vite.config.ts
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@ui': path.resolve(__dirname, './src/client/components/ui'),
},
}
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@ui': path.resolve(__dirname, './src/client/components/ui'),
},
}
and I use the alias like this
import { cn } from '@/shared/utils';
import { Badge } from '@ui/badge';
...
import { cn } from '@/shared/utils';
import { Badge } from '@ui/badge';
...
this is not generate same thing in .wasp/out so for that i did manually edit in the .wasp/out/sdk/wasp/tsconfig.json and it's works in development But the problem is that the project will not be built the build shows errors like this
[ Wasp ] ext-src/admin/dashboards/analytics/TotalPageViewsCard.tsx(1,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/analytics/TotalPayingUsersCard.tsx(2,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/analytics/TotalSignupsCard.tsx(2,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/users/DropdownEditDelete.tsx(2,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/users/SwitcherOne.tsx(3,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/analytics/TotalPageViewsCard.tsx(1,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/analytics/TotalPayingUsersCard.tsx(2,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/analytics/TotalSignupsCard.tsx(2,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/users/DropdownEditDelete.tsx(2,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
[ Wasp ] ext-src/admin/dashboards/users/SwitcherOne.tsx(3,20): error TS2307: Cannot find module '@/shared/utils' or its corresponding type declarations.
` the because the build generates different tsconfig.json how i can fix that ?
18 replies