4 ms·
This is great. I love to see more about front-end load numbers. As we are moving to HTTP/2 and JavaScript heavy applications are everywhere we should stop bund
by msoad 10y ago
This is great. I love to see more about front-end load numbers.
As we are moving to HTTP/2 and JavaScript heavy applications are everywhere we should stop bundling all of JavaScript files into a single big bundle file. It will help with caching a lot because right now we update the bundle if a single line in the code base changes. A lot of front-end build systems are optimized for HTTP/1.1.
- jwr 10y agoIt depends what you mean by "bundling". For ClojureScript, the output is passed through the Google Closure compiler with advanced optimizations. The result is not a concatenation nor just a minimization -- it is a rewritten program, containing just the parts that are needed and significantly optimized. So, the big resulting file is not a "bundle" and can't easily be split into parts.
- mikegedelman 10y agoFor a large application, I wonder if you could configure Closure to output multiple files.. Maybe libraries and such in one file and client code in another? I would imagine you could at least split the code there.
- dragonne 10y agoYes, Closure Compiler can be made to generate multiple files in this way. IIRC you can give it multiple entrypoints and it will generate files with the code unique to each entrypoint, plus one with the shared code.
- coredog64 10y agoWhat do you do during the intervening time where you have to support both?
- tracker1 10y agoIt really depends on how much your users are in your application. It's been best to get to around 2-4 JS files, and 1-2 CSS files for some time, mainly to optimize for the number of simultaneous connections. Short of push, there's still a per-request overhead. And I think it will be a little while before typical web apps are integrated enough to utilize server-side push. There's also the fact that some browsers (IE on < Win10) will languish for a few years, so you may still need to support them, to what extent, who knows. And until there is proper support for native module loading in the majority of browsers, we aren't likely to see separate files widely adopted again. Beyond all of this, as stated above, caching really hasn't worked out so well in practice, and shouldn't be your main optimization unless you are building an internal application that your users regularly utilize... Of course, those are the environments most likely to let best practices slip in terms of meeting deadlines.