我正在尝试使用所有新工具(jspm 0.17.0-beta.40)设置Angular 2应用程序)。ES6导入问题[SystemJS 0.20.9 + TypeScript + Angular 2 + jspm 0.17.0-beta.40]
我正在模拟System
模块。这里的tsconfig.json
:
{
"compileOnSave": false,
"compilerOptions": {
"target": "ES5",
"module": "System",
"moduleResolution": "Node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"rootDir": "../"
}
}
的问题是与ES6 import
。经过这样的事情是transpiled:
import { Component, ViewEncapsulation, AfterViewInit } from '@angular/core';
使用,这将是:
core_1.Component
但不幸的是,在运行应用程序的浏览器无法识别它。
"TypeError: core_1.Component is not a function
at Object.execute (...app/app.component.js:32:24)
at E (...jspm_packages/system.js:4:7541)
at S (...jspm_packages/system.js:4:6746)
at S (...jspm_packages/system.js:4:6646)
at S (...jspm_packages/system.js:4:6646)
at x (...jspm_packages/system.js:4:6102)
at ...jspm_packages/system.js:5:6612"
当我使用ViewEncapsulation
时会出现同样类型的错误。
这是在转储到System
模块时。
运用CommonJS
模块工作(应用程序通过这一步)。
我不能与工作,虽然,因为我用
import html from './app.component.html';
具有以下meta
配置:
meta: {
"*.html": {
"loader": "text"
},
}
哪个失败,出现错误
Error: No template specified for component AppComponent
我有尝试切换版本的JSPM和系统。
显然,在0.20版本的系统中引入的更改会导致此问题。
关于如何解决这个问题的任何想法?
谢谢您的答复。这仅适用于'System',其中模块从节点[github.com/dima-gusyatiner/system-0.20-angular-2](https://github.com/dima-gusyatiner/system-0.20-angular- 2)。这**不起作用**,但是,如果我通过'jspm' [github.com/dima-gusyatiner/system-0.20-jspm-0.17-angular-2](https://github。com/dima-gusyatiner/system-0.20-jspm-0.17-angular-2) – Dimdum