简体   繁体   中英

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. The Network tool shows it takes over seconds to load the 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.

One thing you could do is split your js files into seperate bundles. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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