【发布时间】:2022-12-27 22:50:12
【问题描述】:
I have this on my tsconfig.json
"baseUrl": "app",
"paths": {
"~/*": ["*"]
}
This allows me to import any module as following
import { Foo } from '~/auth'
This works, and tsc compiles without any errors.
However, when I try to run it using node, I get the error
Error: Cannot find module '~/auth'
What can be? I think something is missing because I used to do the same on Next project.
Here is my full
tsconfig.json{ "compilerOptions": { "target": "es5", "module": "commonjs", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true, "experimentalDecorators": true, "strictPropertyInitialization": false, "emitDecoratorMetadata": true, "outDir": "dist", "baseUrl": "app", "paths": { "~/*": ["*"] } }, "include": ["app/**/*.ts"], "exclude": ["node_modules"] }
【问题讨论】:
标签: typescript tsc