-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Description
tl;dr Could we remove the map of path to data file in app-*.js and instead try to fetch data by converting the link path to a data filename, handling 404s if it doesn't exist, etc?
History
I'm experimenting with a Gatsby site that has ~3.5k pages. The bundle sizes are like so:
2.7M app-*.js
240K chunk-manifest.json
300K commons-*.js
I haven't fully understood Gatsby's data structure, but checking the network tools shows that app-*.js is loaded as soon as the page finishes loading.
It seems like the current architecture uses webpack to build a Map of all paths to their path to the relevant file on disk. This means that as the number of pages grows, the site's bundle size grows. I presume this approach will not scale very well for sites with 10k or 100k pages.
Idea
Would it be possible to deterministically map path to data file? Further, if we could do that (which I guess we could), would it be possible to skip the "list of pages" and just fetch data by transforming the path variable into its data file?
Extra thoughts
- I'm super to new Gatsby core development, zero experience with webpack, so my idea might be total nonsense in that context. If so, apologies, feel free to close.
- This would remove the content based hash from the filename, which is a very useful technique for cache busting, etc.