1
+ import { dirname , resolve } from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
1
3
import { unheadVueComposablesImports } from '@unhead/vue'
2
4
import legacy from '@vitejs/plugin-legacy'
3
5
import vue from '@vitejs/plugin-vue'
@@ -12,6 +14,7 @@ import { VitePWA } from 'vite-plugin-pwa'
12
14
import Sitemap from 'vite-plugin-sitemap'
13
15
import VueDevTools from 'vite-plugin-vue-devtools'
14
16
import Layouts from 'vite-plugin-vue-layouts'
17
+ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
15
18
import { createViteVConsole } from './vconsole'
16
19
17
20
export function createVitePlugins ( ) {
@@ -56,6 +59,8 @@ export function createVitePlugins() {
56
59
VueRouterAutoImports ,
57
60
{
58
61
'vue-router/auto' : [ 'useLink' ] ,
62
+ '@/utils/i18n' : [ 'i18n' , 'locale' ] ,
63
+ 'vue-i18n' : [ 'useI18n' ] ,
59
64
} ,
60
65
unheadVueComposablesImports ,
61
66
] ,
@@ -65,6 +70,12 @@ export function createVitePlugins() {
65
70
] ,
66
71
} ) ,
67
72
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
+
68
79
legacy ( {
69
80
targets : [ 'defaults' , 'not IE 11' ] ,
70
81
} ) ,
0 commit comments