Subdomain loads require 30MiB download every time
lidel opened this issue · 3 comments
lidel commented
The ./dist
without .gz
files is ~30MiB.
This means every website that is loaded via subdomain gateway will re-download the same payload before SW can be initialized. This adds 30MiB cost to every website's initial load.
We should reduce the size of subdomain load to minimum to initialize worker. Ideas welcome!
Ideas
- Perhaps we can reuse already cached verified-fetch assets from the root domain, avoid fetching them again, and only have light sw.js handling registration?
- ?
SgtPooki commented
another potential reduction in downloaded resources for subdomains: split all required assets for redirect page into a separate chunk, and update app.tsx to use dynamic imports for different pages
SgtPooki commented
do we have agreed-upon action items for this? If my above proposal is appropriate, then actions should be roughly like so:
- create src/non-subdomain.ts and src/subdomain.ts
- add the above as entries to webpack
- make src/app.ts dynamically load the above based on context
- be sure that src/index.ts is the only file being loaded by webpack, and that it's lightweight (subdomains will load
src/index.ts
+public/index.html
+src/sw.ts
)