Uncaught (in promise) SyntaxError: Not available in legacy mode
解决办法:
const i18n = createI18n({
locale: getLocale(),
+ legacy: false,
messages: messages,
});
export default i18n;
You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.
解决办法:
npm i @intlify/unplugin-vue-i18n
vite
// vite.config.ts
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
export default defineConfig({
plugins: [
VueI18nPlugin({ /* options */ }),
],
})
如果对您有所帮助点赞走一波~~~
如需转载请注明出处!