Replies: 10 comments 1 reply
-
Wondering the same thing. Our app is designed for mobile users to be used in specific locations. If these locations happen to have bad internet connections, a retry feature would be helpful. |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
-
For what it's worth, you can entirely circumvent this issue by not splitting your code. You can disable chunks/code-splitting by setting this config in vite: {
build: {
rollupOptions: {
output: {
inlineDynamicImports: true
}
}
}
} I get that splitting the files is "smart" and all that, and that you potentially achieve a faster initial page-load while not loading stuff you don't need in the current context, but it comes with a lot of (to me) very unnecessary hoops to jump through to handle these chunk load errors. Unless your application is huge, you'll very likely not have any problems with this approach. I also noticed that if I let nuxt/vite handle all the code-splitting itself, I'll end up with a structure that looks something like (after gzip/br): 10-20 files at 4-5kb vs. just inlining everything: In my case at least, there is virtually no gain from splitting the code into so many small files, each of which can fail to load at any time. And something worth noting, before you say "well to mobile users the page might be slow" - yes, correct, but I'd take a slightly slower loading page any day over a page that stops working in the middle of route navigation in a payment flow or something similar where friction/dropoff is a problem. If the page doesn't load, users know they should just do a hard refresh. We've all navigated to a webpage where the CSS doesn't load, and we just retry and move on. Reference: https://rollupjs.org/configuration-options/#output-inlinedynamicimports - note the warning about immediate execution of dynamically imported modules. Your mileage may vary. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Two extremely common Sentry errors on my live Nuxt site are
TypeError: Importing a module script failed
andUnable to preload CSS
. These are almost certainly caused by transient network errors on mobile devices.(The fact that I get the Sentry reports at all shows there are a lot of transient errors. I also have sleep/retry function in my API-accessing code for this reason using fetch-retry and which I can tell succeeds after some retries. So transient network errors are a common thing.)
I'd like to be able to add retrying for loading JS and CSS too - because these are common errors for mobile users. Is this achievable in any way at present?
A couple of notes:
Raising here as requested by @danielroe.
Beta Was this translation helpful? Give feedback.
All reactions