From 2aaaabe3fbcc09b2353de83c88d3dbe4238fc72a Mon Sep 17 00:00:00 2001 From: Eason chiu <76670758@qq.com> Date: Tue, 26 Feb 2019 19:50:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(isDev.ts):=20=E4=BF=AE=E6=94=B9=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/isDev.ts | 18 ++++++++++++++---- package.json | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/isDev.ts b/lib/isDev.ts index 425ed89..a4dc2ff 100644 --- a/lib/isDev.ts +++ b/lib/isDev.ts @@ -1,8 +1,18 @@ -let isDev = true; const env = (process as any).env; -if ((env.PACKAGE && env.PACKAGE === 'production') || (env.REACT_APP_PACKAGE && env.REACT_APP_PACKAGE !== 'dev')) { - isDev = false; +const isDev = () => { + // 旧版本脚手架 + if (env.PACKAGE === 'production') { + return false; + } + + // 新版本(旧版的PACKAGE变量所有环境都会存在,所以只要没有PACKAGE,就认为是新版本) + if (!env.PACKAGE && env.REACT_APP_PACKAGE !== 'dev') { + return false; + } + + return true; } -export default isDev; + +export default isDev(); diff --git a/package.json b/package.json index 6758a38..746db18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "auto-libs", - "version": "0.1.18", + "version": "0.1.19", "description": "凹凸 公用组件", "main": "build/index", "types": "build/index",