webpacks的angular.io文檔(https://angular.io/docs/ts/latest/guide/webpack.html)將應用程序代碼與供應商代碼模塊分開以創建兩個獨立的軟件包。它包括在vendor.ts文件中的下列 -Angular2 w/webpacks的vendor.ts文件的目的是什麼?
// Angular
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';
import '@angular/http';
import '@angular/router';
// RxJS
import 'rxjs';
我錯了推斷,在package.json
列出的應用程序的依賴應該是vendor.ts?如果是這樣,令人困惑的是package.json
中列出的許多但不是所有的依賴項均位於文件中("@angular/compiler", "@angular/forms", "core-js", and "zone.js"
除外)。對標題問題的回答可以幫助我理解爲什麼導入vendor.ts文件中的大多數(但不是全部)依賴項的原因。另外,隨着我的項目的增長,我將如何知道包中的依賴關係。 json應該添加到文件中?
謝謝!那麼在package.json中包含所有的依賴關係會有什麼問題嗎? –
依賴關係使用'package.json'安裝,它們應該在那裏。但實際上由webpack計算的應用程序的依賴關係。如果你不在配置中使用chunk插件,它們都會轉到一個塊'bundle.js'。 –