|
|
|
|
|
by holloway
3863 days ago
|
|
It's been found that resource concatenation is still more efficient http://engineering.khanacademy.org/posts/js-packaging-http2.... And 'building for http2' seems to be advocating hashes in filenames without neccesarily walking the dependencies, which can have cache problems http://holloway.nz/r/hashes-in-filenames/ ES6 imports are static (you can't use JS to dynamically include a file) so this means transitive dependencies need to be resolved at build time, not by using a manifest file which resolves paths clientside. This also applies to (eg) SVGs that reference JPEGs because you probably don't want JS involved there either. Manifest files are a bad idea, except perhaps for instructing webservers to tell browsers to preemptively download files. AFAIK there isn't a standard for this yet so a manifest doesn't solve the problem. Ps. I've got a gulp build for http2-style packing and I'll release it on my github in a few weeks (same account as my username) |
|
for a page with 2.4MB of JS spread over 296 files.
And, notably, the article doesn't advocate for serving individual files in the first place, but instead says that some level of grouping is likely advantageous, but http2 gives new opportunities which will need to be explored, like grouping by level of churn in libraries or by units of functionality
> And 'building for http2' seems to be advocating hashes in filenames without neccesarily walking the dependencies
I believe you misread. They use a shallow tree in their scout js file; all of the resources a page will need are declared there and nothing is loaded in succession.
> Manifest files are a bad idea, except perhaps for instructing webservers to tell browsers to preemptively download files. AFAIK there isn't a standard for this yet so a manifest doesn't solve the problem
I'm not sure what this means. The manifest is generated by the build process. There is no standard for dependency manifests, sure, but there's no reason you can't whip a reasonable one up that a simple server module could understand if you wanted to add push support. Eventually the cow paths will be paved and we'll come up with a more standardized approach (or approaches) to that kind of manifest.