@@ -2,13 +2,17 @@ const _ = require('lodash')
22
33let rootPath = ''
44
5- const mergeConfig = ( objValue , srcValue ) => {
6- if ( _ . isArray ( objValue ) ) {
7- return objValue . concat ( srcValue )
8- } else if ( _ . isObject ( objValue ) ) {
9- return _ . merge ( objValue , srcValue )
5+ const mergeConfig = ( objValue , srcValue , index ) => {
6+ if ( index !== 'locales' ) {
7+ if ( _ . isArray ( objValue ) ) {
8+ return objValue . concat ( srcValue )
9+ } else if ( _ . isObject ( objValue ) ) {
10+ return _ . merge ( objValue , srcValue )
11+ } else {
12+ return srcValue
13+ }
1014 } else {
11- return srcValue
15+ return _ . mergeWith ( objValue , srcValue , mergeConfig )
1216 }
1317}
1418
@@ -98,21 +102,21 @@ const convertPath = (config) => {
98102 const locale = config . locales [ key ]
99103 for ( const key2 in locale ) {
100104 if ( checkPath ( locale [ key2 ] ) ) {
101- result . locales [ key ] [ key2 ] = {
105+ result . locales [ key ] . push ( {
102106 type : 'full' ,
103107 path : config . locales [ key ] [ key2 ]
104- }
108+ } )
105109 } else if ( checkPath ( config . root . locales + '/' + config . locales [ key ] [ key2 ] ) ) {
106- result . locales [ key ] [ key2 ] = {
110+ result . locales [ key ] . push ( {
107111 type : 'full' ,
108112 path : config . root . locales + '/' + config . locales [ key ] [ key2 ]
109- }
113+ } )
110114 } else {
111- result . locales [ key ] [ key2 ] = {
115+ result . locales [ key ] . push ( {
112116 type : 'inside' ,
113117 path : config . root . locales ,
114118 component : config . locales [ key ] [ key2 ]
115- }
119+ } )
116120 }
117121 }
118122 }
@@ -143,6 +147,7 @@ export default (rootDir) => {
143147 }
144148 themeOptions = _ . mergeWith ( themeOptions , config , mergeConfig )
145149
150+
146151 return themeOptions
147152
148153}
0 commit comments