i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Better error handling for dynamic vue-i18n config load errors

Open gbyesiltas opened this issue 11 months ago • 1 comments

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

Additional context

We currently use:

"@nuxtjs/i18n": "9.4.0",
"nuxt": "3.16.1",

and our app is hosted on Cloudflare

gbyesiltas avatar Apr 02 '25 07:04 gbyesiltas

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 🤔

BobbieGoede avatar May 23 '25 16:05 BobbieGoede