【问题标题】:react app is running development mode on Heroku?反应应用程序正在 Heroku 上运行开发模式?
【发布时间】:2022-01-10 20:21:20
【问题描述】:

如果我想部署到 Heroku,我的脚本应该是什么样子?并确保应用程序在生产模式(构建)下运行,所以基本上我将我当前的代码推送到 github 并从 Heroku 部署推送的代码问题是我的应用程序在开发模式下运行并且它完全忽略了构建应用程序出于某种原因知道如何解决这个问题吗?

"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
},

我还希望我的应用程序在欧盟地区运行,但 mars/create-react-app buildpack 将我的应用程序位置设置为美国。

【问题讨论】:

标签: reactjs heroku


【解决方案1】:

您仍然可以使用mars/create-react-appCommon runtime apps always default to the US region,无论您使用的是哪个 buildpack。

创建应用时使用the --region argument

heroku create YOUR_APP_NAME --region eu

然后你可以像往常一样使用mars/create-react-app。如果你想在创建应用的时候设置 buildpack 你可以include the --buildpack flag:

heroku create YOUR_APP_NAME --region eu --buildpack mars/create-react-app

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-09-24
    • 2015-01-05
    • 1970-01-01
    • 2020-04-21
    • 1970-01-01
    • 1970-01-01
    • 2011-11-04
    • 2016-05-17
    相关资源
    最近更新 更多