Skip to content

Commit

Permalink
fix(cli): 修复全局变量为对象时替换的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Apr 12, 2019
1 parent 39e0e66 commit 97067d5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/taro-cli/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,14 @@ exports.generateConstantsList = function (constants) {
const res = { }
if (constants && !exports.isEmptyObject(constants)) {
for (const key in constants) {
try {
res[key] = JSON.parse(constants[key])
} catch (err) {
res[key] = constants[key]
if (_.isPlainObject(constants[key])) {
res[key] = exports.generateConstantsList(constants[key])
} else {
try {
res[key] = JSON.parse(constants[key])
} catch (err) {
res[key] = constants[key]
}
}
}
}
Expand Down

0 comments on commit 97067d5

Please sign in to comment.