2016-09-12 101 views
0

由於某種原因,--prod cli標誌從編譯輸出中刪除了導航欄。任何想法爲什麼?ng build --prod刪除導航欄

我app.component看起來是這樣的:

import { Component } from '@angular/core'; 
import { ROUTER_DIRECTIVES } from '@angular/router'; 

@Component({ 
    selector: 'app-root', 
    template: ` 
      <nav-bar></nav-bar> 
      <router-outlet> 
      </router-outlet>`, 
    directives: [ROUTER_DIRECTIVES] 
}) 

export class AppComponent {} 

我的導航欄組件:

import { Component, OnInit } from '@angular/core'; 
import { GlobalEvent } from '../shared/global.event' 

import { Http, Response } from '@angular/http'; 

@Component({ 
    selector: 'nav-bar', 
    templateUrl: 'navbar.component.html', 
    providers: [GlobalEvent], 
    styleUrls: ['navbar.component.css'], 
}) 
export class NavbarComponent implements OnInit { 
    ... 
} 

注:與--dev標誌工程建設按預期。我希望這不是一個cli問題。

回答

0

顯然這是一個已知的問題與角cli。見here

修復將會nano node_modules/angular-cli/addon/ng2/models/webpack-build-production.ts

和改變mangle: { screw_ie8 : true }, //prod

mangle: { screw_ie8 : true, keep_fnames:true }, //prod