create-react-app配置本地端口port和host以及sourcemap关闭
在项目根目录新建.env文件(环境变量)
//关闭source map GENERATE_SOURCEMAP=false //关闭自动打开浏览器 BROWSER=none //本地host HOST=172.16.3.236 //本地端口 PORT=9001
配置前:

同时会打开浏览器
配置后:

ip和端口都改变了,而且不会打开浏览器
运行npm run build,打好的包不会生成.map文件
赞 (0)