File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export default function i18n(langPath: string = 'lang'): Plugin {
12
12
let exitHandlersBound : boolean = false
13
13
14
14
const clean = ( ) => {
15
+ console . log ( 'clean' )
15
16
files . forEach ( ( file ) => unlinkSync ( langPath + file . name ) )
16
17
17
18
files = [ ]
@@ -25,12 +26,6 @@ export default function i18n(langPath: string = 'lang'): Plugin {
25
26
name : 'i18n' ,
26
27
enforce : 'post' ,
27
28
config ( config ) {
28
- if ( ! hasPhpTranslations ( frameworkLangPath ) && ! hasPhpTranslations ( langPath ) ) {
29
- return
30
- }
31
-
32
- files = generateFiles ( langPath , [ ...parseAll ( frameworkLangPath ) , ...parseAll ( langPath ) ] )
33
-
34
29
/** @ts -ignore */
35
30
process . env . VITE_LARAVEL_VUE_I18N_HAS_PHP = true
36
31
@@ -41,6 +36,13 @@ export default function i18n(langPath: string = 'lang'): Plugin {
41
36
}
42
37
} ,
43
38
buildEnd : clean ,
39
+ buildStart ( ) {
40
+ if ( ! hasPhpTranslations ( frameworkLangPath ) && ! hasPhpTranslations ( langPath ) ) {
41
+ return
42
+ }
43
+
44
+ files = generateFiles ( langPath , [ ...parseAll ( frameworkLangPath ) , ...parseAll ( langPath ) ] )
45
+ } ,
44
46
handleHotUpdate ( ctx ) {
45
47
if ( / l a n g \/ .* \. p h p $ / . test ( ctx . file ) ) {
46
48
files = generateFiles ( langPath , [ ...parseAll ( frameworkLangPath ) , ...parseAll ( langPath ) ] )
You can’t perform that action at this time.
0 commit comments