Does/Will turbopack dev server support HTTP/2? #70432
dwjohnston
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Background
Summary
I've been searching both in Github issues and google, and I can't find much information as it relates to HTTP2.
Where Turbopack's dev server will return individual unbundled modules, the issue becomes that in http1, depending on the browser, a limited number of simultaneous requests are supported (good summary here: https://stackoverflow.com/a/985704).
This means that despite a Turboback NextJS application providing all the individual modules simultaneously - our development experience will still have a waterfall as it waits for the earlier modules to be downloaded.
Additional information
Context: I've been investigating some development performance issues, where essentially we have a NextJS application that is serving up a webpack dev server bundle that is 14MB. I'm investigating whether NextJS 14 + Turbopack might be a quick solution.
I have here a repo where I reproduce this scenario by having a lot of files, most unused, and reference them via barrel files. https://github.com/dwjohnston/bundle-size-investigation/tree/main/scenario-next
If we start the dev server without turbopack, here is the waterfall we get:
To note: We have that one
page.js
file - it's 8.1 MB and takes 435ms to download - no throttling.Here we start the dev server with turbopack:
Now we have several files, notably the barrel files which are 389kB each (in this scenario each barrel file exports 50 functions, each function logging a 10240 character length string)
Although the requests all start simultaneously - you can see the later requests in the requests have most of their time taken up 'queueing' (the white bar) as they have encountered Chrome's max simultaneous requests per domain limit.
Example
https://github.com/dwjohnston/bundle-size-investigation/tree/main/scenario-next
Proposal
Bundled JS files are served with the HTTP/2 protocol when using the
--turbo
option.Beta Was this translation helpful? Give feedback.
All reactions