简体   繁体   English

ASP.NET MVC脚本捆绑包加载时间太长

[英]ASP.NET MVC Script Bundle Takes Too Long To Load

I am out of ideas on this one. 我对此一无所知。 An MVC site we developed takes too long to load. 我们开发的MVC网站加载时间太长。 The Network tool shows it takes over seconds to load the JavaScript! 网络工具显示加载JavaScript需要花费几秒钟的时间! It is in a bundle and being minimized. 它是捆绑在一起的,并且已被最小化。 I can't figure out why this bundle could take so long. 我不知道为什么这个捆绑包可能要花这么长时间。 Any ideas? 有任何想法吗?

bundles.Add(new ScriptBundle("~/scripts/site").Include(
                         "~/Scripts/lib/jquery-1.10.2.js"
                       , "~/Scripts/lib/jquery-migrate-{version}.js"
                       , "~/Scripts/lib/json2.js"
                       , "~/Scripts/lib/knockout-{version}.js"
                       , "~/Scripts/lib/jquery.unobtrusive*"
                       , "~/Scripts/lib/jquery.validate*"
                       , "~/Scripts/lib/jquery-ui*"
                       , "~/Scripts/lib/jquery.lockSubmit*"
                       , "~/images/jquery.js"
                       , "~/images/script.js"
                        ));

Here is the Network Tab of the Dev Tools: 这是开发工具的“网络”选项卡:

在此处输入图片说明

Looking by your network tab screen grab, you have bundled a lot of files together and the size is 0.63 MB which is too big a size for minimized js files. 通过“网络”选项卡屏幕抓图,您已将许多文件捆绑在一起,大小为0.63 MB ,对于最小化的js文件而言,该大小太大。

One thing you could do is split your js files into seperate bundles. 您可以做的一件事是将js文件拆分为单独的捆绑包。 Also could u share the actual size of the js files you are using, I find it very strange that the files you mentioned after minimized is still too big. 您还可以共享您正在使用的js文件的实际大小吗,我感到很奇怪,您最小化后提到的文件仍然太大。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM