bla*_*zek 5 typescript systemjs angular
我正在尝试使用Typescript和SystemJS工作Angular2,但我遇到了导入问题.
使用此导入(或任何其他angular2导入)
import {bootstrap} from 'angular2/platform/browser';
Run Code Online (Sandbox Code Playgroud)
我得到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
Run Code Online (Sandbox Code Playgroud)
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"
]
}
Run Code Online (Sandbox Code Playgroud)
并在jspm.config.js中配置
System.config({
defaultJSExtensions: true,
transpiler: "typescript",
paths: {
"github:*": "../jspm_packages/github/*",
"npm:*": "../jspm_packages/npm/*"
}})
Run Code Online (Sandbox Code Playgroud)
这段代码以某种方式工作,但编译器似乎很困惑,有更好(或正确)的方法如何做到这一点?谢谢
小智 2
目前在 Webstorm 11 中这是不可能的。有一个实际有效的解决方法,请参阅 David Festen 的评论: https: //youtrack.jetbrains.com/issue/WEB-18904。
顺便说一下,请+1 这个问题,也许这有助于加快 Jetbrains 提出修复的速度。
| 归档时间: |
|
| 查看次数: |
616 次 |
| 最近记录: |