skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

Server push #302

Closed mfulton26 closed 2 years ago

mfulton26 commented 2 years ago

This might be already implemented and I'm simply not observing it correctly or have things set up wrong.

I'm trying to explore how feasible it is to skip bundling my app with with Webpack or something similar and instead have a CDN like Skypack push all the JavaScript modules to the user agent.

Today as I understand it a user agent receives the index.html which then references some JavaScript modules at which point it then requests those and if those have import statements in them then it requests those. For a shallow tree of dependencies this is a little slow but probably fine for some cases. However, the deeper the tree of dependencies the longer it will take to get that initial loading of the web app to happen and the slower it will load. Tree levels are loaded serially. After an initial loading of the app this is less of an issue except when updates get rolled out. What I'd like to see is that this entire tree is pushed to user agents and if they already have things cached then the user agent can cancel the push promises.

Is this something that is feasible with JavaScript modules? Does Skypack support it? Is there any documentation on things to watch out for, etc.? Thank you.

mfulton26 commented 2 years ago

I just learned this morning that https://evertpot.com/http-2-push-is-dead/. 🤯

See also https://github.com/denoland/dotland/issues/2205.