create-react-app build deploy on LAMP/XAMPP/WAMP

前端 未结 4 1500
星月不相逢
星月不相逢 2020-12-16 02:36

How to deploy the build on Apache WAMP/XAMPP server?

I have an app created with create-react-app and I have two pages on this applicati

4条回答
  •  情话喂你
    2020-12-16 03:22

    By default, your react project is built to be deployed directly into your server 'www' (root) folder. Hence you may copy the contents of your project 'build' folder to the WAMP 'www' folder and then go to http://localhost/ in your browser. Your project will be displayed.

    Alternatively, you may want to use a WAMP root subfolder, e.g. 'www/react/'. In this case add to your package.json file a homepage key:

    "homepage": "http://localhost/react/",
    

    Then build your project again:

    npm run build
    

    Finally, copy the contents of your project 'build' folder to 'www/react/'. To display your project visit http://localhost/react/

    You may get more information in How to deploy a React App on Apache web server

提交回复
热议问题