Vue packaged and released inaccessible after running a tomcat, solutions appear blank page problem

phenomenon

Use npm run build front-end publishing packages vue project http: // localhost: 8080 / xxx (released under the webapps folder name) a blank page, use F12 to see the figure below:

the reason

Since the introduction of packaged webpack css js-peer file path is absolute, thus resulting in tomcat web server such as a relative path not visit a blank page and ERR_ABORTED errors occur.

solve

1. publicPath increase in the build / webpack.prod.conf.js in: './' below

Note: The author himself is amended Article 1, after packing it can be a normal visit.

If you can not access normal you can try 2 and 3, as a deeper reason has not been studied in depth.

2. Modify config / index.js value to the assetsPublicPath ./

3.build/util.js added publicPath: '../../',

 

Published 84 original articles · won praise 145 · Views 350,000 +

Guess you like

Origin blog.csdn.net/u011095110/article/details/104451365