SolidStart bundle into a single file
I have an app which is mostly static and only has two types of pages but lots and lots of images. So not much JS but lots of images. Also I need it to work well on slow networks (i.e. phones). I'm serving over HTTP3 on Cloudflare.
I am using SolidStart because I need prerendering for SEO, which then means I am using file based routing which means the JS is getting split up into around 13 files.
My problem is that whilst the JS starts loading straight away, it doesn't finish until much later because it is waiting for the images to finish.
No matter what I do I can't find a way to ensure the JS is loaded first. I've tried adding
From what I've read, SolidStart is meant to be pretty modular and so I'm hoping it might be possible to write an add on or fork a repo to achieve this but I'm not sure. I'm about a year into this project and ready to launch soon but need to find a fix for this first.
I am using SolidStart because I need prerendering for SEO, which then means I am using file based routing which means the JS is getting split up into around 13 files.
My problem is that whilst the JS starts loading straight away, it doesn't finish until much later because it is waiting for the images to finish.
No matter what I do I can't find a way to ensure the JS is loaded first. I've tried adding
loading="lazy" fetchpriority="low" decoding="async" to the images and putting the JS in <head> but the problem seems to boil down to the fact that whilst the first JS files are loading, all the other connections get filled up with images so when the JS then requests subsequent modules, they are "pending" and have to wait for some of the images to finish. On a slow network this can be a long time. So the only solution I can see is having all (or as much as possible) of the JS in a single file. I don't care about any performance benefits from only loading the JS needed for a given route.From what I've read, SolidStart is meant to be pretty modular and so I'm hoping it might be possible to write an add on or fork a repo to achieve this but I'm not sure. I'm about a year into this project and ready to launch soon but need to find a fix for this first.

SolidStart