我剛剛創建了一個新的角度4項目與CLI:ng new test
如何使樹搖動一個新的角度4項目
版本:
@angular/cli: 1.0.0
node: 6.10.0
os: win32 x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1
然而,樹搖不工作正確,因爲我的未使用的類FooBar
仍然在main.*.js
文件中。
我的樣品組分TS文件(FooBar的不應該是輸出):
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app works!';
}
export class FooBar {
foo = "hello";
}
我試圖用匯總(如在文檔中描述),但這沒有工作,以及...
是否有一種簡單的方法來啓用樹狀結構? (我預計它通過CLI創建項目時默認啓用)。
更新:我使用ng build --prod
,它仍然沒有振盪..
您使用的是什麼'ng'命令? –
我正在使用'ng build --prod',但它仍然沒有振動。 –
CLI是否甚至使用樹抖?從食譜中的樹木搖動的angular.io文檔中,它使用匯總樹震動。但查看CLI的源代碼,package.json中沒有彙總依賴關係。除非他們使用別的東西來搖樹。我試圖找出這個相同的東西。 –