编译时出现无法修复的错误:/
index.ts:2:19 - error TS2307: Cannot find module '@shared'
有什么想法是为什么?
项目结构:
tsconfig.json:
{
"compilerOptions": {
"outDir": "../../build/backend",
},
"extends": "../../configs/tsconfig.base.json",
"references": [
{
"path": "../shared"
}
],
"paths": {
"@shared": [
"../shared/index"
]
}
}
backend/index.ts:
import 'module-alias/register'
import { x } from '@shared'
console.log(x)
shared/index.ts:
export const x = 'this is shared index'