【发布时间】:2022-01-03 15:09:43
【问题描述】:
编译时出现无法修复的错误:/
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"
]
}
}
后端/index.ts:
import 'module-alias/register'
import { x } from '@shared'
console.log(x)
共享/index.ts:
export const x = 'this is shared index'
【问题讨论】:
标签: typescript