1+ import { dirname , resolve } from 'node:path'
2+ import { fileURLToPath } from 'node:url'
13import { unheadVueComposablesImports } from '@unhead/vue'
24import legacy from '@vitejs/plugin-legacy'
35import vue from '@vitejs/plugin-vue'
@@ -12,6 +14,7 @@ import { VitePWA } from 'vite-plugin-pwa'
1214import Sitemap from 'vite-plugin-sitemap'
1315import VueDevTools from 'vite-plugin-vue-devtools'
1416import Layouts from 'vite-plugin-vue-layouts'
17+ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
1518import { createViteVConsole } from './vconsole'
1619
1720export function createVitePlugins ( ) {
@@ -56,6 +59,8 @@ export function createVitePlugins() {
5659 VueRouterAutoImports ,
5760 {
5861 'vue-router/auto' : [ 'useLink' ] ,
62+ '@/utils/i18n' : [ 'i18n' , 'locale' ] ,
63+ 'vue-i18n' : [ 'useI18n' ] ,
5964 } ,
6065 unheadVueComposablesImports ,
6166 ] ,
@@ -65,6 +70,12 @@ export function createVitePlugins() {
6570 ] ,
6671 } ) ,
6772
73+ // https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n
74+ VueI18nPlugin ( {
75+ // locale messages resource pre-compile option
76+ include : resolve ( dirname ( fileURLToPath ( import . meta. url ) ) , '../../src/locales/**' ) ,
77+ } ) ,
78+
6879 legacy ( {
6980 targets : [ 'defaults' , 'not IE 11' ] ,
7081 } ) ,
0 commit comments