tsconfig弄乱了node_modules导入

时间:2018-07-24 11:52:41

标签: angular typescript

我的return RefreshIndicator( onRefresh: () { var action = RefreshItemsAction(); store.dispatch(action); return action.completer.future; }, child: ListView(...) ); 如下:

tsconfig.json

这让我对我的应用程序和环境代码具有简单易读的导入。但是,Visual Studio Code现在将建议可怕的{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./src", "paths": { "@app/*": ["app/*"], "@env/*": ["environments/*"] }, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": ["node_modules/@types"], "lib": ["es2017", "dom"] } } 导入。例如这个:

node_modules

不仅限于:

import { AppInsightsService } from '../../../../node_modules/@markpieszak/ng-application-insights';

我尝试将import { AppInsightsService } from '@markpieszak/ng-application-insights'; 更改为以下内容:

tsconfig.json

我希望我的vscode能够按预期导入{ "compileOnSave": false, "compilerOptions": { "baseUrl": ".", "paths": { "*": ["*"], "@app/*": ["src/app/*"], "@env/*": ["src/environments/*"] }, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": ["node_modules/@types"], "lib": ["es2017", "dom"] } }

1 个答案:

答案 0 :(得分:0)

显然这是TypeScript 2.9.2的问题。

GitHub问题:https://github.com/Microsoft/vscode/issues/52089

解决方案:使用工作区版本或等待升级