Better error handling for dynamic vue-i18n config load errors
Describe the feature
We have been seeing some Sentry issues on this line where we get the vue-i18n config resolver. The error we are seeing is TypeError: Right side of assignment cannot be destructured.
We have not really been able to reproduce this in a meaningful way but we see on Sentry that almost all of the issues are coming from iOS Safari browsers. This makes me think it is related to Safari caching the scripts and trying to load a config file with an outdated hash. Though what is interesting is that the await configFile() does not fail; but it returns undefined (I verified this with a package-patch to add more logging).
In any case, since it's a dynamic import statement, it could also just be a network failure, so we should probably have some error handling here. I have opened a PR before with a tentative fix of reloding the app; but another possible solution could also be emitting a chunk error and leaving the handling to the project developers.
Additional information
- [x] Would you be willing to help implement this feature?
- [ ] Could this feature be implemented as a module?
Final checks
- [x] Read the contribution guide (The contribution guideline of nuxt-modules/i18n is compliant with Nuxt too).
- [x] Check existing discussions and issues.
Additional context
We currently use:
"@nuxtjs/i18n": "9.4.0",
"nuxt": "3.16.1",
and our app is hosted on Cloudflare
This issue seems similar to https://github.com/nuxt/nuxt/issues/29624 which unfortunately hasn't been resolved yet, something about the way Nuxt/Nitro handle dynamic imports causes these to resolve to undefined 🤔