From 97067d5eb6bc29227f278f47cf0713de364525a2 Mon Sep 17 00:00:00 2001 From: luckyadam Date: Fri, 12 Apr 2019 16:09:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(cli):=20=E4=BF=AE=E5=A4=8D=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=8F=98=E9=87=8F=E4=B8=BA=E5=AF=B9=E8=B1=A1=E6=97=B6?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/util/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/taro-cli/src/util/index.js b/packages/taro-cli/src/util/index.js index a4061d8fdfcb..80fdff900176 100644 --- a/packages/taro-cli/src/util/index.js +++ b/packages/taro-cli/src/util/index.js @@ -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] + } } } }