env.NODE_ENV始终在REACT APP中返回默认值

时间:2019-07-04 16:44:11

标签: node.js reactjs frontend

尝试1:

"scripts": {
    "start": "react-scripts start",
    "build": "set REACT_APP_STAGE=dev && react-scripts build",
    "test": "react-scripts test",
}

尝试2:

"scripts": 
"start": "react-scripts start",
    "build": "NODE_ENV=dev&&react-scripts build",
    "test": "react-scripts test"
}

//Also tried with and without space

脚本

export const configuration = process.env.NODE_ENV === 'production'
    ? prod
    : dev;
  
      
  • 总是返回本地开发并进行生产
  •   

我知道有很多问题我尝试了所有没有用的组合。

0 个答案:

没有答案