React App not starting in azure app service

前端 未结 5 1378
天命终不由人
天命终不由人 2020-12-10 18:00

I\'ve deployed a simple react app to azure app service and it won\'t start:

How do I get the app to run index.html?

5条回答
  •  我在风中等你
    2020-12-10 18:53

    So thanks to Burke Holland. The easiest is to create a build folder running

    npm run build
    

    Then you copy your build folder into your destination and add a "ecosystem.config.js" file.

    module.exports = {
      apps: [
        {
          script: "npx serve -s"
        }
      ]
    };
    

    See this link for more information: https://burkeknowswords.com/this-is-how-to-easily-deploy-a-static-site-to-azure-96c77f0301ff

    Note: This works for a deployment to a Node Linux App Service instance in Azure. No client side routing configuration needed with this approach!

    For Windows App service you can create a config file for configuring your client side routing.

提交回复
热议问题