0

What to do if the concatenated + mangled main.js file is just too big? It's now ~2300kB and it's ever growing. Although the dependencies are not too big by themself. We are using jQuery, jQuery UI and jqTouch. jQ is ~90kB minified and others can't be too much bigger.

So the answer "drop some deps" maybe is not feasible enough :/ Have you ever faced with a problem like that? How did you come over the problem?

Thanks

edit: Sorry my bad, I forgot to mention that it's a hybrid mobile project, so this asset will be downloaded to the device, although we have an App in Browser feature which stands for the standard way. So CDN is a good advice for App in Browser but not for the device :/

Attila Kling
  • 1,717
  • 4
  • 18
  • 32
  • 1
    And gzip server compression – nullpotent Jul 08 '15 at 10:03
  • 4
    How the heck does any website need 2.3Mb of JavaScript code? My entire codebase for a complex browser-based game takes less than that with PHP, HTML, CSS and JS combined! – Niet the Dark Absol Jul 08 '15 at 10:04
  • gzip is a must on live code! – Jamie Hutber Jul 08 '15 at 10:04
  • Use a CDN for things like jQuery and don't merge them in, turn on compression and a decent cache life time. – Lloyd Jul 08 '15 at 10:04
  • Hi @SamuelLiew, won't work, it's a hybrid mobile project. The time of loading the asset is probably not a direct problem since it's already on the device -> no need to load it, but parsing the file can be an issue. Also WebKit has a cache size limitation(?!). So I guess, even in an env. like this it makes sense to make the bundle smaller. Anyways, thanks for your response. – Attila Kling Jul 08 '15 at 10:04
  • Also, identify parts that are not needed at the very start, and load them dynamically, when they are required. requirejs can do this. – nullpotent Jul 08 '15 at 10:06
  • @NiettheDarkAbsol It's one of the biggest JS projects out there, said by others. I'm not truly convinced about this but people with more knowledge than me said it so.. :) – Attila Kling Jul 08 '15 at 10:15
  • @iccthedral We already use RequireJS and it's optimizer with r.js so the really simple optimizations are already made I guess :( – Attila Kling Jul 08 '15 at 10:16

0 Answers0