Improving imports in Webstorm 11 using JSPM and Typescript

I am using JSPM and Typescript for an Angular2 project, and Webstorm 11 seems to confuse the import paths of TS classes.

enter image description here

The first import is correct:

import {Component} from "angular2/core";

But the other two are referenced directly from the jspm_packages folder, importing these two paths:

 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 ignored both node_modules and jspm_packages in tsconfig.json since it seems that Webstorm is recognizing it, but so far no luck.

Is there a way to configure Webstorm to automatically import the correct module and ignore the other two?

+6
source share
1 answer

jspm is not currently supported by Webstorm. But node.js is. If you install angular2 via npm, then import works:

 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 

+1
source

All Articles