我在使用IIS的ASP.NET Core解決方案上使用VS2015 RC3,Angular2 2.0.0。Kendo UI Angular:(SystemJS)意外的令牌<
每當我嘗試添加一個新的UI模塊,比如下拉菜單或輸入,我得到一個SystemJS錯誤,但奇怪的是,我的按鈕,沒有任何問題,工作...
master.module.ts:
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
import { InputsModule } from '@progress/kendo-angular-inputs';
@NgModule({
imports: [
CommonModule,
MasterRouting,
ButtonsModule, // => Works fine and button is showing as expected
InputsModule, // Error : Unexpected Token
DropDownsModule // Error : Unexpected Token
],
[...]
我得到這些錯誤(這取決於我嘗試在我的「進口」陣列添加哪些模塊:
InputsModule錯誤:在導入指向在我master.modules.ts線
zone.js:192 Error: (SystemJS) Unexpected token < SyntaxError: Unexpected token < at Object.eval (http://localhost:39351/app/master/master.module.js:35:30)
DropdownsModule錯誤:
zone.js:192 Error: (SystemJS) Unexpected token < SyntaxError: Unexpected token < at Object.eval (http://localhost:39351/node_modules/@progress/kendo-angular-dropdowns/dist/npm/js/combobox.component.js:630:19)
這一個顯示我的劍道庫導入:
module.exports = require("@telerik/kendo-dropdowns-common/dist/npm/js/bundle");
我做當然,我在我的wwwroot ...
編輯:正如你可以看到在錯誤列表中,它試圖評估@telerik包與一個不正確的路徑,所以我想錯誤是從那裏來的,但爲什麼他們不爲他們設置SystemJS配置telerik軟件包在文檔中?我在那裏錯過了什麼?
我完全喪失,因此任何幫助,不勝感激......
這裏有一些其他文件的情況下,它們可以幫助:
tsconfig.json:
{
"compilerOptions": {
"outDir": "./wwwroot/app/",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"inlineSourceMap": true,
"inlineSources": true
},
"exclude": [
"./node_modules/**",
"./wwwroot/**",
"./typings/**"
]
}
個systemjs.config.js:
(function (global) {
// map tells the System loader where to look for things
var map = {
// Our components
'app': 'app', // 'dist',
// Angular2 + rxjs
'@angular': 'node_modules/@angular',
'rxjs': 'node_modules/rxjs',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
// Kendo Angular2
'@progress/kendo-angular-buttons': 'node_modules/@progress/kendo-angular-buttons',
'@progress/kendo-angular-dropdowns': 'node_modules/@progress/kendo-angular-dropdowns',
'@progress/kendo-angular-inputs': 'node_modules/@progress/kendo-angular-inputs',
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
// Our components
'app': { defaultExtension: 'js'},
// Angular2 + rxjs
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'@progress/kendo-angular-buttons': {
main: './dist/npm/js/main.js',
defaultExtension: 'js'
},
'@progress/kendo-angular-dropdowns': {
main: './dist/npm/js/main.js',
defaultExtension: 'js'
},
'@progress/kendo-angular-inputs': {
main: './dist/npm/js/main.js',
defaultExtension: 'js'
},
};
/**** node_modules basic config ! Do not touch ****/
// name of packages to assimilate (angular 2 only here)
var ngPackageNames = [
'common',
'compiler',
'core',
'forms',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade',
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/' + pkgName] = { main: 'index.js', defaultExtension: 'js' };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/' + pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
map: map,
packages: packages
};
System.config(config);
/**** node_modules basic config ! Do not touch ****/
})(this);
我做了它的工作,所以我的建議是做一些看起來像plunkr的東西,這樣你的systemJS也接受@telerik包的依賴關係。 –
這應該是一個評論而不是答案。請澄清您的答案以消除猜測或刪除答案。一旦你有足夠的聲譽,你可以留下評論。 –
嗯,它更像是一些有用的信息,在2個systemjs.config.js文件之間存在一個增量,所以人們應該檢查該問題以解決問題。另外Telerik在他們說的這個時候沒有任何指導。 – Josh