在Angular版本4中,我在执行 ng build 时出现工厂错误。
当我执行 ng服务时效果正常。
我的猜测是@ ngx-meta / core出了问题。 (https://www.npmjs.com/package/@ngx-meta/core)
我不明白iTerm构建错误。
这是我的iTerm错误:
这是我的主要内容:
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);
这是我的app.module:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { routes } from './app.routes';
import { MetaModule } from '@ngx-meta/core';
//App
import { AppComponent } from './app.component';
//Pages
import { HomeModule } from './components/home/home.module';
//Shared
import { HeaderModule } from './components/shared/header/header.module';
import { FooterModule } from './components/shared/footer/footer.module';
@NgModule({
imports: [
BrowserModule,
HeaderModule,
FooterModule,
HttpModule,
RouterModule.forRoot(routes),
MetaModule.forRoot(),
HomeModule,
PageNotFoundModule
],
declarations: [
AppComponent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [
],
bootstrap: [AppComponent]
})
export class AppModule { }
这是我的家庭组成路线:
import { Route} from '@angular/router';
import { MetaGuard } from '@ngx-meta/core';
import { HomeComponent } from './home.component';
export const HomeRoutes: Route[] = [
{
path: '',
canActivate: [MetaGuard],
component: HomeComponent,
data : {
meta: {
title : 'Title',
}
}
}
];