我将我的项目移至带有Lerna和纱线工作区的monorepo。 我设法设置了基本的内容,但是我仍然遇到这个问题,无法在网络上找到类似的问题。
如下图所示,我无法使路径别名intellisense适用于“当前”程序包src。 您知道我们在tsconfig中的一个普通项目中这样声明的那个
"paths": {
"@/*": [
"src/*"
]
},
当我直接在vscode中打开packages / pro-app文件夹时,它可以正常工作,但是当我打开root monorepo时,我遇到了这个问题
Webpack构建也可以正常工作
这是<root>tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"strictNullChecks": false,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"jest"
],
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
和packages/pro-app/tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"strictNullChecks": false,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"jest"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}
我尝试了不同的路径配置,但无法使其工作:/
在monorepo中仍然可以使用“ @ / *”别名吗?
或者也许我不应该在vscode中打开monorepo? juste逐个打包
谢谢