4 ms·
I've spent the last 2 years building B2B SPAs and, like everything in software, they can be fast or slow depending on how you build the app and what tools you u
by sibit 4y ago
I've spent the last 2 years building B2B SPAs and, like everything in software, they can be fast or slow depending on how you build the app and what tools you use. I usually leverage lit-html, esmodules, and the dynamic import syntax. If you only fetch the business logic and views when you need them you can have an app that renders in seconds with an initial payload of ~15kb.
I usually also set up a service worker to prefetch and cache the rest of the site while cache busting specific files on subsequent visits.
Personally I use SPAs for offline support and MPAs for "portals" and brochure/marketing websites or blogs.
- treis 4y ago>that renders in seconds That's really long.
- sibit 4y agoOh geese, I didn't realize that I forgot to add "on slow-3g". We usually aim for <1s FCP & <2s LCP. If it's ever above 5s on slow-3g we set aside time to optimize/refactor. Since our SPAs are offline-first the return visits (usually 3-5 times a day based on the customer) is on the scale of milliseconds.
- treis 4y agoEven still. A 3g connection is a bit under half a MB a second. That's a lot of data for something that is mostly text.
- sibit 4y agoI feel like we're just spinning in circles trying to define "fast" and what speeds are "acceptable" when the main point was: > SPAs for offline support and MPAs for everything else You could build MPAs that offer offline support (and I have) but I find that you spend a lot of time writing the same render logic twice. Things might be different now with Next/Nuxt but when you're using PHP or C# it sucks to write the view render logic twice.