React如何配置env环境变量

React版本: "react": "^18.2.0"

1、在package.json平级目录下创建'.env'文件

2、在‘.env’文件里配置环境变量

【1】PUBLIC_URL

描述:编译时文件的base-href

官方描述:

// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
// webpack needs to know it to put the right 
                    
                    

你可能感兴趣的:(React,react.js,javascript,前端)