Deployment of the address of the vue project on the server

first of all, my project is not in the root directory of the server, so it is assumed that the directory name is website to facilitate the following description

according to what I said on the Internet, I set the build.assetsPublicPath under config/index.js to"/ website/", and started

at the same time.

history mode, routing is set to base:"/ website/"

question:

    After the
  • project is deployed to the server, I want to add the prerender-spa-plugin pre-dyeing plug-in, but I always report an error when generating the file. After google has checked the relevant information ( github ), I found that it is because build.assetsPublicPath is set, and only the default / can be successful, but the project directory cannot be moved. This question is shelved
  • then, there is another problem with the deployment of the project to the server. Sometimes the click route is invalid. Check the console and find that the error is as follows:
Error: Loading chunk 4 failed. at HTMLScriptElement...

and google found that it is necessary to change assetsPublicPath , manual sweat ~

I just want to know how I can successfully deploy to the server subdirectory without path reference errors after setting assetsPublicPath as the default / .

Oct.20,2021

dev is also changed to /
and then developed with static/.. Visit the static server

under static
. There must be a file where you visit. Otherwise, it is not impossible to rely on your idea
to achieve your goal. Just forward it and go to an existing address

.
Menu