Create-React-App build - “Uncaught SyntaxError: Unexpected token <”

后端 未结 9 1452
予麋鹿
予麋鹿 2020-12-10 10:35

I realize this question has been asked multiple times but nothing has worked for me...

I\'m trying to create a static build of a create-react-app projec

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 11:05

    Remove the "homepage": "app-url" from package.json. Absence of homepage in package.json will assume that it will be hosted at the server root, or you will serve the build with serve -s build.

    And Yes, specifying homepage will be helpful when you are going to deploy the App in a sub-directory of the server root.

    To host your app on the IIS with the name somedomain.net and your solution already has a Web API project.

    1. You will map the solution folder with the main Web app i.e., somedomain.net
    2. You will convert the Web API project to Application from IIS.
    3. Then you will convert the build folder of React App to web App just like Web API
    4. To make front-end App working specify the "homepage": "somedomain.net/React-Project/Client-App/build"

提交回复
热议问题