Home > Web Front-end > JS Tutorial > body text

How to deploy react project in tomcat

藏色散人
Release: 2023-01-04 09:37:20
Original
4228 people have browsed it

How to deploy react projects in tomcat: First use "npm run build" to package the project; then put the contents of the packaged folder into the Root under webapps in tomcat; finally open the server to access "localhost: 8080" port is enough.

How to deploy react project in tomcat

The operating environment of this tutorial: windows7 system, tomcat10.0&&react17.0.1 version, Dell G3 computer.

Recommended: "react video tutorial"

tomcat deploys react project

Deployment method:

  • Use npm run build to package the project

  • Put the contents of the packaged folder into the Root under webapps in tomcat

  • Start the server Access localhost:8080 port to see your project content

Pitfalls that are not placed in the Root directory:

Due to the default path.js [path : The configuration of your react project name\node_modules\react-scripts\config\path.js] is '/', which is valid for the root directory, so if it is not placed under the root, you need to change '/' to './' That is, relative paths are valid. (Modify the code at about line 45)

How to deploy react project in tomcat

At this time you can access your react project through localhost:8080/project name

The above is the detailed content of How to deploy react project in tomcat. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!