From 6919e692795af2529a5dde4bd6707e233cce6567 Mon Sep 17 00:00:00 2001 From: sky-admin <546485299@qq.com> Date: Sun, 5 May 2019 14:55:57 +0800 Subject: [PATCH 1/3] fix bug because value could null first time --- packages/webpack-plugin/lib/runtime/injectHelper.wxs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webpack-plugin/lib/runtime/injectHelper.wxs b/packages/webpack-plugin/lib/runtime/injectHelper.wxs index e37b3b8a06..604dc44863 100644 --- a/packages/webpack-plugin/lib/runtime/injectHelper.wxs +++ b/packages/webpack-plugin/lib/runtime/injectHelper.wxs @@ -91,7 +91,7 @@ function isDef (v) { } function stringifyClass (value) { - if (value === undefined) return '' + if (!value) return '' if (likeArray(value)) { return stringifyArray(value) } @@ -179,7 +179,7 @@ function mergeObjectArray (arr) { } function normalizeDynamicStyle (value) { - if (value === undefined) return {} + if (!value) return {} if (likeArray(value)) { return mergeObjectArray(value) } From 465c0e4826340bc8b0c3c0555575b77dd9b16e4e Mon Sep 17 00:00:00 2001 From: sky-admin <546485299@qq.com> Date: Sun, 5 May 2019 15:08:53 +0800 Subject: [PATCH 2/3] fix bug and lint --- .eslintrc.js | 7 +++++-- packages/webpack-plugin/lib/runtime/injectHelper.wxs | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c6ff795d21..f6c7d406ab 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,9 +14,12 @@ module.exports = { 'swan': false, 'Component': false, 'Page': false, - 'App': false + 'App': false, + '__mpx_mode__': false, + 'getRegExp': false }, rules: { - 'no-cond-assign': 0 + 'no-cond-assign': 0, + "camelcase": ['error', {'allow': ['__mpx_mode__']}] } } diff --git a/packages/webpack-plugin/lib/runtime/injectHelper.wxs b/packages/webpack-plugin/lib/runtime/injectHelper.wxs index 604dc44863..464ba890ed 100644 --- a/packages/webpack-plugin/lib/runtime/injectHelper.wxs +++ b/packages/webpack-plugin/lib/runtime/injectHelper.wxs @@ -77,13 +77,12 @@ function concat (a, b) { return a ? b ? (a + ' ' + b) : a : (b || '') } - function isObject (obj) { return obj !== null && typeof obj === 'object' } function likeArray (arr) { - return arr.constructor === 'Array' + return arr && arr.constructor === 'Array' } function isDef (v) { From 96809964e7327bdb09eb08db962c204526e6133b Mon Sep 17 00:00:00 2001 From: sky-admin <546485299@qq.com> Date: Sun, 5 May 2019 15:12:26 +0800 Subject: [PATCH 3/3] fix lint --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index f6c7d406ab..6fd75af112 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -20,6 +20,6 @@ module.exports = { }, rules: { 'no-cond-assign': 0, - "camelcase": ['error', {'allow': ['__mpx_mode__']}] + "camelcase": ['error', {'allow': ['__mpx_mode__', '__swan_exports_map__']}] } }