Open owlyowl opened 6 days ago
I observe similar issue after upgrading @intlify/unplugin-vue-i18n to version 5+.
In my case it seems to be happening when the t is used programmatically in setup, eg
const { t } = useI18n();
const message = t('messages.test');
It turned out in my case the problem was with other dependencies, I updated Vue and vue-i18n itself and it now seems to work.
Reporting a bug?
We spent the day trying to track down a CSP bug:
In looking through previous GitHub issues I've realised we need to reference the esm-bundler in
vue.config.js
:Because the non bundler version calls
new Function(...
which throws a CSP errorAdding the alias in vue.config.js to
vue-i18n/dist/vue-i18n.runtime.esm-bundler.js
now stops the CSP bug occurring but throws a new error:Locales are in json format:
So now we're stuck with, not use the alias, or use it and it breaks.
Expected behavior
JSON translations and i18n esm prod bundler should initialise correctly.
Reproduction
i18n.ts is like so:
Similar to this issue I feel like I'm on the same journey with a no resolution though: https://github.com/intlify/vue-i18n/issues/381
Issue Package
vue-i18n-loader
System Info
Screenshot
No response
Additional context
I had to add:
In order to stop the non runtime version creating
new Function(
and causing the error:Here is my vue.config.js file:
Validations