I am currently working on a project using VS2015 RC3, Angular2 2.0.0 within an ASP.NET Core solution hosted on IIS.
When attempting to incorporate new UI modules like dropdowns or inputs, I keep encountering a SystemJS error. However, strangely enough, my buttons work perfectly without any issues...
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
],
[...]
The errors I encounter are dependent on which module I attempt to add in the "imports" array:
InputsModule error: pointing at the import line in my 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 error:
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)
This particular error highlights the import in the kendo library:
module.exports = require("@telerik/kendo-dropdowns-common/dist/npm/js/bundle");
which I have verified exists in my wwwroot...
EDIT: From the error logs, it seems that there is an issue with evaluating the @telerik bundle with an incorrect path. But then, why hasn't SystemJS configuration been set up for the telerik packages in the documentation? Am I missing something here?
https://i.sstatic.net/DJH6r.png
I am feeling completely baffled by this issue, so any assistance would be greatly appreciated...
Here are some additional files that may provide further insight:
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);