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:
- Element add font packaging error resolution
- Vue3 uses webpack bundle analyzer to analyze package files
- Vue init webpack command error Vue cli / node_ modules/_ [email protected]@rimraf/rimraf.js :313
- When starting Vue project: cannot find module ‘webpack cli/bin/config yargs’ error [How to Fix]
- Webpack Upgrade Error: webpack.NamedModulesPlugin is not a constructor
- VUE Error: Cannot find module ‘webpack/bin/config-yargs’
- NPX webpack cannot find module’html webpack plugin’a bug causes headache
- Vue cli · failed to download repo vuejs templates / webpack: read econnreset
- Vue error resolution: TypeError: Cannot read property’_t’ of undefined”
- Vue error resolution: typeerror: cannot read property ‘_ t’ of undefined”
- Has HTML webpack plugin been installed, or error: cannot find module ‘HTML webpack plugin’
- Run webpack error: Error: Cannot find module’webpack/lib/node/NodeTemplatePlugin’
- Solution to Vue cli · failed to download repo vuejs templates/webpack: connect etimeout followed by an IP digital error message
- Vue element UI uses this. $notify is not a function problem resolution using the notification box
- Vue project error: uncaught typeerror: vuex__ WEBPACK_ IMPORTED_ MODULE_ 1__ . default.store is not a constructor
- Get picture captcha with Python + Chrome
- Vue + TS reports an error after configuring the path alias
- Vue Error in v-on handler: “TypeError: path.indexOf is not a function“
- sys.path.append(), os.path.exists(), os.path.join() and os.makedirs() meaning
- Relative path and absolute path${ pageContext.request.contextPath }