Replies: 1 comment 2 replies
-
Just as the vue compiler compiles SFC into javascript code in production mode via the vue-loader and vite plugin, vue-i18n compiles i18n resources such as json and yaml into the following Bundle as javascript code using a bundler-oriented loader/plugin. There are also vue-i18n docs the below, so why vue-i18n needs to be built as javascript code in production. In your application, you are fetching yaml data via The following example may help you with your application. |
Beta Was this translation helpful? Give feedback.
-
I have multiple (currently 2) translation files, specified in YAML. I want those files to be outside of source control, so they can be changed and deployed without a new build from source. I'm using Vue3 (3.2.31) and vue-i18n (9.1.9), and vite (2.8.5). The files are preloaded using axios and yamlParse.
This works great in dev/hmr mode, but breaks in prod mode, when accessing
someVueInstance.$t
(I think); the message in the dev console is:The code looks like this:
Can anyone post a working example? I'm not sure where/who to blame, as this works properly in development (HMR) mode, and there are no obvious issues in loading the messages via axios, prior to instantiating vue-i18n, in prod mode.
Help???
Beta Was this translation helpful? Give feedback.
All reactions