Original link: https://www.wikimoe.com/?post=278
The root cause is that the css-loader used by the new vue-cli will treat “/a.png” as “require(‘/a.png’)” by default.
At this point, you need to configure vue.config.js, add the following content
css: { loaderOptions: { css: { url: { filter: url => url[0] !== '/' } } } }
Reference link: https://github.com/vuejs/vue-cli/issues/7032
This article is transferred from: https://www.wikimoe.com/?post=278
This site is only for collection, and the copyright belongs to the original author.