Next.js Discord

Discord Forum

importing in next js using @

Unanswered
Pteromalid wasp posted this in #help-forum
Open in Discord
Pteromalid waspOP
import is working when i use relative path but not when using @ (absolute path)

14 Replies

is your tsconfig setup properly?
Chub mackerel
tsconfig should contains this
"compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./*"] } }
@Chub mackerel tsconfig should contains this ` "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./*"] } }`
Pteromalid waspOP
its like this
@Yi Lon Ma is your tsconfig setup properly?
Pteromalid waspOP
i guess the above is correct and not working in some files but working other files
see
Pteromalid waspOP
@Pteromalid wasp its like this
Chub mackerel
did you use src file?
Pteromalid waspOP
i don't have src file or folder
Chub mackerel
try this structure in your tsconfig
{ "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./*"] } }, "plugins": [ { "name": "next" } ] }
@Chub mackerel try this structure in your tsconfig `{ "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./*"] } }, "plugins": [ { "name": "next" } ] } `
Pteromalid waspOP
yeah i changed but its still the same like if i open the file then its showing error if i close the file then it not
i changed it to "@/": ["./"]
but some errors got solved but some are not same error name
Chub mackerel
is this project open source?