I am trying to set up short-hand paths in my project to work with both my rootDir and outDir, and it keeps giving me this error:
Error: Cannot find module '@models/Client'
Require stack:
- C:\Users\~\dist\test\index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
at Module._load (node:internal/modules/cjs/loader:928:27)
at Module.require (node:internal/modules/cjs/loader:1149:19)
at require (node:internal/modules/helpers:121:18)
at Object.<anonymous> (C:\Users\~\dist\test\index.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1267:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\~\\dist\\test\\index.js'
]
}
This is my tsconfig:
{
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"rootDir": "src",
"outDir": "dist",
"moduleResolution": "nodenext",
"baseUrl": ".",
"paths": {
"@models/*": [
"./src/models/*",
"./dist/models/*"
]
},
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"include": [
"src"
],
"exclude": [
"node_modules",
"dist"
]
}
Thank you for considering my issue.