新的 Angular 2.0.0-rc.5 项目需要最少的包?
Minimal packages required for a new Angular 2.0.0-rc.5 project?
我正在做涉及 Angular 2 的第二个项目。在第一个 Angular 2 项目热身后,从 Angular 1.5 跳转时,我真的对如何 trim 下包感兴趣。我想知道我可以在不丢失核心功能的情况下从 package.json
文件中删除什么。每个包有什么作用,我应该保留什么?
目前我的理解是这样的:
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server", // I use Webstorm, Visual Studio or Xampp
"postinstall": "typings install", // ???
"tsc": "tsc",
"tsc:w": "tsc -w", // Maybe I will keep
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.5", // ng-if, ng-for seem to reside in here
"@angular/compiler": "2.0.0-rc.5", // renders the templates
"@angular/core": "2.0.0-rc.5", // :)
"@angular/forms": "0.3.0", // I could manage without, I use custom css
"@angular/http": "2.0.0-rc.5", // Need it
"@angular/platform-browser": "2.0.0-rc.5", // ???
"@angular/platform-browser-dynamic": "2.0.0-rc.5", // ???
"@angular/router": "3.0.0-rc.1", // Need it
"@angular/router-deprecated": "2.0.0-rc.2", // Nope
"@angular/upgrade": "2.0.0-rc.5", // Nope
"systemjs": "0.19.27", // importing modules
"core-js": "^2.4.0", // Some polyfills, Does Chrome 52.0 needs it?
"reflect-metadata": "^0.1.3", // Decorators ??
"rxjs": "5.0.0-beta.6", // depdency for EventEmitter
"zone.js": "^0.6.12", // data bindings don't work wihtout
"angular2-in-memory-web-api": "0.0.15", // ???
"bootstrap": "^3.3.6" // No need, I do all my css hand forged to perfection.
},
"devDependencies": {
"concurrently": "^2.0.0", // Nope
"lite-server": "^2.2.0", // Nope
"typescript": "^1.8.10", // Nope ? I learned that Webstorm can do this job
"typings":"^1.0.4" // Nope ?
}
}
你找错人了。
如 the official blog post accompanying the RC5 release
中所述
Roughly 60% of Angular’s code size is the compiler [...] so enabling AoT compilation means you don’t have to ship that code to your users
如果您关心的是减少网络传输的字节数,我建议您学习如何通过将 AoT 编译合并到您的构建过程中来利用它(对于您的问题,这将允许您删除 compiler
和 platform-browser-dynamic
生产包中的模块)
还值得注意的是,在准备最终发布时削减这些模块的大小 is one of the major focuses for RC6,因此恕我直言,使用 RC5 执行您正在执行的操作主要是浪费时间。
我正在做涉及 Angular 2 的第二个项目。在第一个 Angular 2 项目热身后,从 Angular 1.5 跳转时,我真的对如何 trim 下包感兴趣。我想知道我可以在不丢失核心功能的情况下从 package.json
文件中删除什么。每个包有什么作用,我应该保留什么?
目前我的理解是这样的:
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server", // I use Webstorm, Visual Studio or Xampp
"postinstall": "typings install", // ???
"tsc": "tsc",
"tsc:w": "tsc -w", // Maybe I will keep
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.5", // ng-if, ng-for seem to reside in here
"@angular/compiler": "2.0.0-rc.5", // renders the templates
"@angular/core": "2.0.0-rc.5", // :)
"@angular/forms": "0.3.0", // I could manage without, I use custom css
"@angular/http": "2.0.0-rc.5", // Need it
"@angular/platform-browser": "2.0.0-rc.5", // ???
"@angular/platform-browser-dynamic": "2.0.0-rc.5", // ???
"@angular/router": "3.0.0-rc.1", // Need it
"@angular/router-deprecated": "2.0.0-rc.2", // Nope
"@angular/upgrade": "2.0.0-rc.5", // Nope
"systemjs": "0.19.27", // importing modules
"core-js": "^2.4.0", // Some polyfills, Does Chrome 52.0 needs it?
"reflect-metadata": "^0.1.3", // Decorators ??
"rxjs": "5.0.0-beta.6", // depdency for EventEmitter
"zone.js": "^0.6.12", // data bindings don't work wihtout
"angular2-in-memory-web-api": "0.0.15", // ???
"bootstrap": "^3.3.6" // No need, I do all my css hand forged to perfection.
},
"devDependencies": {
"concurrently": "^2.0.0", // Nope
"lite-server": "^2.2.0", // Nope
"typescript": "^1.8.10", // Nope ? I learned that Webstorm can do this job
"typings":"^1.0.4" // Nope ?
}
}
你找错人了。
如 the official blog post accompanying the RC5 release
中所述Roughly 60% of Angular’s code size is the compiler [...] so enabling AoT compilation means you don’t have to ship that code to your users
如果您关心的是减少网络传输的字节数,我建议您学习如何通过将 AoT 编译合并到您的构建过程中来利用它(对于您的问题,这将允许您删除 compiler
和 platform-browser-dynamic
生产包中的模块)
还值得注意的是,在准备最终发布时削减这些模块的大小 is one of the major focuses for RC6,因此恕我直言,使用 RC5 执行您正在执行的操作主要是浪费时间。