gpt4 book ai didi

node.js - 在 aws elasticbeanstalk 上配置 React-create-app 的生产环境

转载 作者:太空宇宙 更新时间:2023-11-03 23:21:02 25 4
gpt4 key购买 nike

我已经在aws elastic-beanstalk上部署了react-create-app,并且它正在开发环境中运行。

如何配置生产环境?

最佳答案

使用 npm run build 构建时,NODE_ENV 始终设置为 '生产'

There is also a special built-in environment variable called NODE_ENV. You can read it from process.env.NODE_ENV. When you run npm start, it is always equal to 'development', when you run npm test it is always equal to 'test', and when you run npm run build to make a production bundle, it is always equal to 'production'. You cannot override NODE_ENV manually. This prevents developers from accidentally deploying a slow development build to production.

来源:https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-custom-environment-variables

关于node.js - 在 aws elasticbeanstalk 上配置 React-create-app 的生产环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49858753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com