cra的文档地址
https://www.html.cn/create-re...
我这里定义了接口环境变量
.env.production
REACT_APP_API_URL=https://xxx.com
.env.development
REACT_APP_API_URL=http://localhost:3001
然后package.json中
"start:dev": "yarn run start",
"start:prd": "yarn run start",
现在我想本地跑线上的环境,start:prd命令应该怎么写?
使用
--mode
指定就可以了。yarn run start --mode production
具体文档 👉 Mode | webpack。