简体   繁体   English

使用JSPM和Typescript改进Webstorm 11中的导入

[英]Improving the imports in Webstorm 11 using JSPM and Typescript

I am using JSPM and Typescript for an Angular2 project and Webstorm 11 seems confused about the import paths of the TS classes. 我使用JSPM和Typescript作为Angular2项目,Webstorm 11似乎对TS类的导入路径感到困惑。

在此输入图像描述

The first import is the correct one: 第一个导入是正确的:

import {Component} from "angular2/core";

But the other two are referencing directly from the jspm_packages folder importing this two paths incorectly: 但另外两个是直接从jspm_packages文件夹引用,直接导入这两个路径:

import {Component} from "../../jspm_packages/npm/angular2@2.0.0-beta.0/src/core/metadata";
import {Component} from "../../jspm_packages/npm/angular2@2.0.0-beta.0/ts/src/core/metadata";

I have ignored both node_modules and jspm_packages in tsconfig.json as Webstorm seems to recognize it, but no luck so far. 我忽略了这两个node_modulesjspm_packagestsconfig.json作为Webstorm似乎认识到它,但至今没有运气。

Is there any way i can configure Webstorm to automatically import the correct module and ignore the other two? 有什么方法可以配置Webstorm自动导入正确的模块而忽略其他两个?

jspm is currently not supported by Webstorm. Webstorm目前不支持jspm。 But node.js is. 但是node.js是。 If you install angular2 via npm the imports work: 如果您通过npm安装angular2,则导入工作:

npm i angular2@2.0.0-beta.2 es6-promise@^3.0.2 es6-shim@^0.33.3 reflect-metadata@0.1.2 rxjs@5.0.0-beta.0 zone.js@0.5.10 --save

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Lodash与TypeScript和JSPM结合使用 - Using lodash with typescript and jspm 将jspm与TypeScript一起使用 - Using jspm with TypeScript 如何在 WebStorm/IntelliJ 中使用 ts-node 导入项目库来运行 TypeScript 暂存文件? - How to run a TypeScript scratch file with imports of a project library using ts-node in WebStorm/IntelliJ? 将Eclipse Palantir TypeScript插件与JSPM结合使用 - Using Eclipse Palantir TypeScript Plug-in with JSPM 带有相对导入的JSPM捆绑包 - JSPM bundle with relative imports 在WebStorm 11中使用TypeScript调试Ionic 2项目 - Debugging Ionic 2 project with TypeScript in WebStorm 11 如何在 WebStorm / PhpStorm 中自动按字母顺序对 TypeScript 文件的导入进行排序? - How to sort imports alphabetically for TypeScript files automatically in WebStorm / PhpStorm? WebStorm 中的所有导入在 TypeScript 后端项目中显示为未使用 - All imports in WebStorm shown as unused at TypeScript backend project Webstorm 11 无需编译即可检查 typescript 个文件。 使用webpack进行编译 - Webstorm 11 check typescript files without compiling. Using webpack for compilation 使用System.js,Jspm和TypeScript加载jquery.inputmask - Loading jquery.inputmask using Systemjs, Jspm and TypeScript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM