JSPM and Typescript import

I am trying to work Angular2 with Typescript and SystemJS, but I am having import issues.

With this import (or with any other Angular2 import)

import {bootstrap} from 'angular2/platform/browser'; 

I get Webstorm and tsc compiler errors (WS: cannot resolve directory, tsc: cannot find module), although there is Angular2 in jspm_packages / npm / angular2 @ 2.0.0-beta. 0

my directory structure

 browser components app.component.ts bootstrap.ts index.html node_modules jspm_packages jspm.config.js package.json tsconfig.json 

tsconfig.json

 { "compilerOptions": { "target": "ES5", "module": "system", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "filesGlob": [ "!./node_modules/**/*.ts", "!./jspm_packages/**/*.ts", "./**/*.ts" ] } 

and config in jspm.config.js

 System.config({ defaultJSExtensions: true, transpiler: "typescript", paths: { "github:*": "../jspm_packages/github/*", "npm:*": "../jspm_packages/npm/*" }}) 

This code somehow works, but the compiler seems confused, is there a better (or right) way to do this? Thanks

+5
source share
1 answer

This is currently not possible in Webstorm 11. There is a workaround that really works, see David Festen's comment at: https://youtrack.jetbrains.com/issue/WEB-18904 .

By the way, please +1 this problem, perhaps it helps to speed up the work of Jetbrains to come up with a fix.

+2
source

Source: https://habr.com/ru/post/1238943/


All Articles