使用Visual Studio Community 2017,我在一个TypeScript项目中有多个子项目,每个子项目都是一个几乎是自包含的项目,包含所需的一切,其中包括自己的 tsconfig.json ,例如:
{
"extends": "./../../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./src/scripts/application",
"paths": {
"@vuex-store/*": [ "store/*" ]
}
}
}
如您所见,它继承自最顶层的tsconfig.json:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2017"
],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"noResolve": false,
"removeComments": false,
"skipLibCheck": true,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es2017",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
".awcache",
".tsc",
"bin",
"node_modules",
"obj",
"**/*.spec.ts"
],
"include": [
"src/**/*.ts",
"@types/**/*.d.ts"
]
}
尝试import menuModule from "@vuex-store/modules/menu/index";
时,我可以在“错误”标签中看到
TS2307找不到模块'@ vuex-store / modules / menu / index'
并且,如果构建项目,我从构建引擎得到相同的错误。
在Webpack构建之后运行项目就像魅力一样,所以这肯定是Visual Studio的一个问题,即使IDE Visual Studio 能够找到并导航到模块,导入和解决“menuModule”上的intellisense。
它是Visual Studio中的错误吗?