[Vuejs]-Load vue-i18n messages before routes are loaded

0👍

import(/* webpackChunkName: "lang-[request]" */ `~/lang/${locale}`) is a Webpack Async Import, so it will be loaded after your main app script is loaded, not at the same time.

I will recommend two solution (pick the one that suits you better):

  1. remove your loadMessages functions and load all Json-s synchronously. The app bundle will grow (all translations will be inside) but it will load them on the app start.
  2. Delay router creation (router = new Router(...)) until all the locales are loaded (loadMessages finished).

Leave a comment