【发布时间】:2020-07-24 14:49:24
【问题描述】:
我正在 App Engine 上运行基本的 create-react-app 生产构建,但我无法访问我的预定义环境变量。我缺少任何额外的步骤吗?我猜它与构建过程和提供生产构建有关,但我不确定在这种情况下在哪里设置变量。
app.yaml:
service: client-dev
runtime: nodejs10
env_variables:
TEST: "development"
package.json:
"scripts": {
"start": "serve -s build",
"start-dev": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
console.log(process.env.TEST) //undefined
【问题讨论】:
标签: node.js reactjs google-app-engine google-cloud-platform create-react-app