Ant*_*ddy 3 chunks angular2-services angular
目前正在使用高级 ui 框架(如版本 2 和 4 的角度)实现我的用户界面代码。
当我想将代码部署到服务器时,我需要通过发出以下命令“ ng build --prod ”来构建项目,因此正在生成许多块文件。
我想知道为什么会生成这些块文件。
小智 5
因为 Angular 是一个单页应用程序。
当您为应用程序提供服务时,也会生成这些块。这是我的ng serve命令的结果(没有标志,只是服务):
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-04-10T12:09:49.010Z
Hash: 7e4a7d27b89ee3d81e37
Time: 15613ms
chunk {administration.module} administration.module.chunk.js () 9.22 kB [rendered]
chunk {exploitation.module} exploitation.module.chunk.js () 1.26 MB [rendered]
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 625 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 623 kB [initial] [rendered]
chunk {scripts} scripts.bundle.js (scripts) 562 kB [initial] [rendered]
chunk {source-post.module} source-post.module.chunk.js () 1.42 MB [rendered]
chunk {styles} styles.bundle.js (styles) 653 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 18.9 MB [initial] [rendered]
webpack: Compiled successfully.
Run Code Online (Sandbox Code Playgroud)
如您所见,块也在那里生成。
块代表纯 Javascript 代码。在这段代码中,您将找到您的样式、模板和所有 Angular 功能(组件、服务……)。
Angular 使用这些块来呈现动态页面。实际上,当您在 SPA 上导航时,您实际上从未离开过index.html页面。此文件的内容由您的块替换。
| 归档时间: |
|
| 查看次数: |
5543 次 |
| 最近记录: |