我正在尝试使用Typescript和SystemJS工作Angular2,但我遇到了导入问题.
使用此导入(或任何其他angular2导入)
import {bootstrap} from 'angular2/platform/browser';
我得到Webstorm和tsc编译错误(WS:无法解析目录,tsc:找不到模块),即使jspm_packages/npm/angular2@2.0.0-beta.0中有angular2
我的目录结构是
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" ] }
并在jspm.config.js中配置
System.config({ defaultJSExtensions: true, transpiler: "typescript", paths: { "github:*": "../jspm_packages/github/*", "npm:*": "../jspm_packages/npm/*" }})
这段代码以某种方式工作,但编译器似乎很困惑,有更好(或正确)的方法如何做到这一点?谢谢