Skip to content

Commit

Permalink
fix(isDev.ts): 修改判定方式
Browse files Browse the repository at this point in the history
  • Loading branch information
easonchiu committed Feb 26, 2019
1 parent 2305703 commit 2aaaabe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions lib/isDev.ts
Original file line number Diff line number Diff line change
@@ -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();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auto-libs",
"version": "0.1.18",
"version": "0.1.19",
"description": "凹凸 公用组件",
"main": "build/index",
"types": "build/index",
Expand Down

0 comments on commit 2aaaabe

Please sign in to comment.