Ahm*_*bel 0 environment-variables node.js reactjs dotenv
我有一个带有 build 文件夹的 React 应用程序(由: npm run build 生成),我想在 .env 文件中包含 3 个变量(只有一个文件):
REACT_APP_API_URL=http://localhost:3000/api ( for production)
REACT_APP_PROD_URL=http://localhost:3001/api ( for staging)
REACT_APP_STAGIN_URL=http://localhost:3002/api ( for development)
Run Code Online (Sandbox Code Playgroud)
并在 npm run build 文件夹中使用它们
yarn add env-cmdpackage.json:"start-qa": "env-cmd -f .env.qa react-scripts start"
或构建:
"build-qa": "env-cmd -f .env.qa react-scripts build"
| 归档时间: |
|
| 查看次数: |
7657 次 |
| 最近记录: |