Skip to content

Eslint + Typescript + Nextjs 10 absolute imports cannot find module or its corresponding type declarations #19891

Answered by hjaimee
hjaimee asked this question in Help
Discussion options

You must be logged in to vote

If anyone happens to run into this issue and get here I was able to solve the issue by adding the src directory in the include of my tsconfig.json file also note this only worked if I set the following

"baseUrl": ".", // removed src from baseurl "paths": { // ensure paths were updated relative to base url "@static/*": ["./public/static/*"], "@generated/*": ["./src/__generated__/*"], "@*": ["./src*"] } "include": [ "src", // add src directory to be included "next-env.d.ts", "**/*.ts", "**/*.tsx", "next.config.js", "public" ],

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@mrfzd
Comment options

@kellygue
Comment options

@arnelamo
Comment options

Answer selected by hjaimee
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
8 participants