How to resolve 'Cannot find module' and 'noEmit' issues in TypeScript project with Vite? #4151
Replies: 3 comments 1 reply
-
| Could you do the following: move the configuration into the "tsconfig.app.json" file and add the following inside "compilerOptions": 
 | 
Beta Was this translation helpful? Give feedback.
-
| In my project, I copied everything from the "tsconfig.app.json" and "tsconfig.node.json" files and added it all to the main file, which is "tsconfig.json". From my point of view, it doesn't make much sense to create two configuration files, as it will depend on the size of each project. It turned out like this: | 
Beta Was this translation helpful? Give feedback.
-
| Hi, I have the same error, even after applying @Loureto's fix. | 
Beta Was this translation helpful? Give feedback.






Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Cannot find module: I'm encountering an error Cannot find module
@/lib/utilseven though I have configured path aliases in bothtsconfig.jsonandvite.config.ts. It seems like TypeScript or Vite isn't resolving the alias properly.tsconfig.json
{ "files": [], "references": [ { "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" } ], "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./src/*"] } } }vite.config.ts
I still couldn't get the alias right If I import using relative directory path working fine but the @ alias has an error.
Beta Was this translation helpful? Give feedback.
All reactions