我正在学习Angular2,当我启动应用程序时,控制台报告错误:
Error: (SystemJS) Unexpected token <
SyntaxError: Unexpected token <
at eval (<anonymous>)
systemjs.config.js
System.config({
transpiler: 'typescript',
typescriptOptions: {
emitDecorationMetadata: true,
target: 'ES5',
module: 'commonjs'
},
map: {
'@angular': 'node_modules/@angular',
'rxjs': 'node_modules/rxjs'
},
paths: {
'node_modules/@angular/*': 'node_modules/@angular/*/bundles'
},
meta: {
'@angular/*': { 'format': 'cjs' }
},
packages: {
'app': {main: 'main', defaultExtension: 'ts'},
'rxjs': {main: 'Rx'},
'@angular/core': {main: 'core.umd.min.js'},
'@angular/common': {main: 'common.umd.min.js'},
'@angular/compoler': {main: 'compiler.umd.min.js'},
'@angular/platform-browser': {main: 'platform-browser.umd.min.js'},
'@angular/platform-browser-dynamic': {main: 'platform-browser-dynamic.umd.min.js'}
}
});
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
这是app.module.ts文件
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
import ApplicationComponent from './components/application/application';
@NgModule({
imports: [ BrowserModule ],
declarations: [ ApplicationComponent ],
providers: [],
bootstrap: [ ApplicationComponent ]
})
export class AppModule { }
这是application.ts文件
import { Component } from '@angular/core';
@Component({
selector: 'auction-application',
template: ``
})
export default class ApplicationComponent {
}
main.ts是app的输入文件。但是我找不到为什么会出现这个错误。