如果即时通讯使用延迟加载模块,则在构建时我的角度应用程序main.bundle.js文件大小会减小 [英] if im using lazy loading module my angular application main.bundle.js file size is decreased while build

查看:47
本文介绍了如果即时通讯使用延迟加载模块,则在构建时我的角度应用程序main.bundle.js文件大小会减小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用构建应用程序时,如何减小vendor.bundle.jsmain.bundle.js文件的大小

How can i reduce my vendor.bundle.js and main.bundle.js file size while build my application using

ng build --aot false --prod

ng build --aot false --prod

如果我使用延迟加载模块,则在构建时我的角度应用程序main.bundle.js文件大小会减小.

if im using lazy loading module my angular application main.bundle.js file size is decreased while build.

推荐答案

ng本身没有任何优化.如果您执行build --help,则可以看到可以传递的所有标志,以进一步优化代码并减小输出大小.

ng build by itself does not have any optimizations. If you ng build --help you can see all the flags you can pass to further optimize your code and reduce the output sizes.

尝试ng build -prod -aot -vc -cc -dop --buildOptimizer,看看您的电话号码是多少.这将启用生产模式,使用AOT,将供应商块用于第三方库,将所有通用代码提取到一个通用块中,确保输出路径是干净的,最后使用@ angular-devkit/build-optimizer进行进一步的优化

Try ng build -prod -aot -vc -cc -dop --buildOptimizer and see what your numbers are. This will enable production mode, use AOT, use a vendor chunk for third party libs, pull all common code out into a common chunk, make sure the output path is clean and lastly use the @angular-devkit/build-optimizer for further optimizations.

如果仍然很大,请在应用程序中对正在使用的第三方库进行遍历. (1)您要导入整个RxJS库吗? (2)所有本地化的时刻?等.

If that is still large, then do a run through in your application for third-party libraries that you are using. (1) Are you importing the entire RxJS library? (2) Moment with all localizations? etc..

这篇关于如果即时通讯使用延迟加载模块,则在构建时我的角度应用程序main.bundle.js文件大小会减小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆