These are chat archives for systemjs/systemjs

7th
Sep 2018
enure
@enure
Sep 07 2018 17:02

I am using Rollup's code splitting feature and exporting in SystemJS format.

I'm curious if the below code (my main bundle) will take advantage of http2 in order to negate the performance overhead of loading multiple chunks from the server on page load?

System.register(["./chunk-b2ba690f.min.js","./chunk-52caf207.min.js","./chunk-fd95067c.min.js","./chunk-401fb40e.min.js","./chunk-aa283001.min.js"], ...

Specifically I guess I'm wondering if the above requests would take advantage of http2's multiplexing feature.

Guy Bedford
@guybedford
Sep 07 2018 18:06
@enure one of the features of the Rollup output is that it adds dependencies that aren't just dependencies of that chunk, but all dependencies of all chunks being loaded
that is why the list of dependencies is so long in what you posted
this is exactly designed to take advantage of http2 - as soon as the response arrives, all the dependencies are fetched in parallel on the next roundtrip
so any load is guaranteed to get the full dependency tree in one or two round trips at the very most
enure
@enure
Sep 07 2018 18:07
That's great to hear. Thanks!
I guess one follow-up question. Would the same be true if I used AMD as the export format when code-splitting in Rollup?
Guy Bedford
@guybedford
Sep 07 2018 18:08
sure, no problem! Yes this is done for all module format outputs, although there's an open ticket to remove it for CommonJS only