The website cannot run after the vuecli is packaged.

  • ask for help, the website cannot run after vuecli is packaged.

my directory in the development is also very simple, the source code is under src, all other static resources are placed in static, and static is full of pictures and json static files

.

clipboard.png

v then because I need to deploy the website to a directory similar to www.baidu.com/you163 in the server root directory, and then modify the webpack configuration, change the build: assetsPublicPath in config/index.js to assetsPublicPath: / you163/", background is done with nodejs+express, and then throw all the generated index.html+static directories into the / you163 directory of the static resources set by express.static.
v now I visit the http://www.ych1987.xyz/you163/ website blank. F12 checks that the network request has only three JS files in the dist/js directory generated by webpack: app, manifest, vendor and app.css generated by dist/css. These four requests are normal, but there are no network errors and no other scarlet letter requests on the console.

v another point of doubt is that the spa website I made through vuecli can access the pages in the vue route through http://localhost:8080/cart. If the deployment on the server is normal, can I access it through http://www.ych1987.xyz/you163...? Of course, the current deployment of problematic access / cart address returns the error Cannot GET / you163/cart of express, or do I need to modify the code of the background nodejs?

Thank you first! ~ *

Jun.23,2022

app.use (express.static ('/ you163'))
is this set?


take a look at your express configuration code for static resource paths


the default access path for Express is index.html in public. Don't put a you163 folder in public. It is impossible to access the two floors. If you want to access you163 directly, you need to set the static default path of express to you163. If you can use live-server to run and access normally after being packaged in development, then it should be OK.

Menu