Angular2在执行ng build --prod时出现以下错误,应用程序在本地运行良好。我不知道为什么会发生此错误,main.ts中的哪一行有问题。 这是main.ts文件。
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
这是路线:
import { NgModule /* ModuleWithProviders */ } from '@angular/core';
import { Routes, RouterModule, /* PreloadAllModules */ } from '@angular/router';
import { ProductComponent } from './products/dashboardPerformance/basic/basic.component';
import { OrderComponent } from './products/dashboardPerformance/advanced/advanced.component';
const appRoutes: Routes = [
{path:'Product',component:ProductComponent},
{path:'order',component:OrderComponent}
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes, { /* preloadingStrategy: PreloadAllModules */ })
],
exports: [
RouterModule
]
})
export class AppRouting {
}
角度版本:
"devDependencies": {
"@angular/cli": "1.0.1",
"@angular/compiler-cli": "4.0.3",
"ts-node": "3.0.2",
"tslint": "^5.1.0",
"typescript": "2.2.2"
},
"dependencies": {
"@angular/animations": "4.0.3",
"@angular/common": "4.0.3",
"@angular/compiler": "4.0.3",
"@angular/core": "4.0.3",
"@angular/flex-layout": "2.0.0-beta.7",
"@angular/forms": "4.0.3",
"@angular/http": "4.0.3",
"@angular/material": "2.0.0-beta.4",
"@angular/platform-browser": "4.0.3",
"@angular/platform-browser-dynamic": "4.0.3",
"@angular/platform-server": "4.0.3",
"@angular/router": "4.0.3",