Vue picture path, webpack error resolution after packaging

Recently, there is a problem in the project: when the SRC attribute of img tag is used as a relative path in HTML, and then the project is packaged and deployed online with webpack, the image path will report an error. Because it was built by ourselves, so I stepped on a lot of pits. Baidu has common problems. The problem of wrong image path was solved after a long time.

1. Find config – & gt; In index.js, modify as follows

2. Find build – & gt; Utils.js, add a sentence in it: ‘… /… /’,

3. Img tag introduces the image

<img src="static/images/list_icon.png" alt="">


Read More: