Vue solves the problem that the Element UI icon does not display after deployment to the server or after build (404 error)

Error display: 

problem causes:

(1) Looking at the /build/webpack.base.conf.js file, you can find that fonts such as woff or ttf will be processed by the url-loader to generate corresponding files in the static/fonts directory.

 

(2) In other words, the font icon should actually be obtained through the /static/fonts/** path, but the actual request is /static/css/static/fonts/**, and a 404 error is naturally reported.

Solution: 

(1) Open the build/utils.js file and add publicPath in the following location:'../../'

 

(2) Re-build and release, and display normally.

 

Guess you like

Origin blog.csdn.net/SmartJunTao/article/details/108536891