quasar
quasar copied to clipboard
Workaround for `useI18n` is generating warnings in a loop
The workaround for using i18n
with composition api currently described here: https://quasar.dev/start/upgrade-guide#vue-i18n-v9 causes some problems for me.
When used it generated the following warning message:
[intlify] Not supported 'formatter'.
[intlify] Not supported 'preserveDirectiveContent'.
And on HMR it then ends up in a loop where there is a constant stream of warnings clogging the console. Using the useI18n
method exported by vue-i18n
does not have this issue, so I resolved to using that. Is there anyone else having this same issue?
I am using unplugin-auto-import
together with script setup
, it might also have something to do with that if nobody else has this same problem.
I have the same problem with all the errors you mention, but they don't end in an infinite loop. There are just lots of them. It seems that they are generated only when Vue Dev Tools is activated. Try in an incognito window without opening Vue Dev Tools and see if you have the same problem.
I also use the built-in useI18n
, as the proposed example doesn't have the options
param.
Is there a way to solve it?
createI18n, options, legacy: false
To elaborate on what @95sunny said: If you are using the composition API with vue-i18n, you need to add legacy: false
to the options passed to createI18n
.
https://vue-i18n.intlify.dev/guide/advanced/composition.html#basic-usage
I'm getting hundreds of thousands of these warnings and it's crashing my tab in storybook just by having a custom warnHandler defined in my app. I'm not using the composition API
To elaborate on what @95sunny said: If you are using the composition API with vue-i18n, you need to add
legacy: false
to the options passed tocreateI18n
.https://vue-i18n.intlify.dev/guide/advanced/composition.html#basic-usage
this save my day! thank you!