Skip to content

Commit 7f25aa8

Browse files
committed
fix: fix config for apps
1 parent ff15af1 commit 7f25aa8

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/setupConfig.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ const _ = require('lodash')
22

33
let 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

Comments
 (0)