Vue project construction

our front-end construction method is as follows: after the vue project build, the dist is sent to the server tomcat to restart. Now you want to send the two packaged project An and B to unified tomcat webapps and webapps- > projectB respectively. After the build restart, you can only access project A under webapps. How can project B access it at the same time?

base is configured in vue-router:"/ projectB/", is invalid

The

base document is introduced as follows:
the base path of the application. For example, if the entire single-page application service is under / app/, then base should be set to "/ app/"

May.27,2022

should be configured in tomcat. You are deployed on the same server as the backend.


is the right way to pack.
if the server path is in projectB, the project path base can be changed to projectB packaging.


this problem was solved last week as follows:
the front-end project is based on Vue CLI 3:
1) publicPath is configured in vue.config.js, such as publicPath:'/ projectB/';
2) vue-router routing configuration, such as base:'/ projectB/';
3) Host configuration in server.xml under tomcat:
< Context path= "projectA" docBase= "projectA/dist" reloadable= "true" / >
< Context path= "projectB" docBase= "projectB/dist" reloadable= "true" / >

Note:
1)
webapps->
projectA-> dist-> build file
projectB-> dist-> build file
2) the publicPath attribute in vue.config.js must be valid in @ vue/cli-service version ^ 3.2.0


change base to. /

Menu