Vue-cli 3.0 releases the packaging of pictures in npm vue package css

rt. Background-image is used in
style.

a {
display: inline-block;
background-image: url("../assets/img/editor.png");
background-repeat: no-repeat;
width: 30px;
height: 30px;
border: 5px solid -sharpfff;
background-size: 380px 60px;
overflow: hidden;
text-indent: 110%;
&:hover {
  background-position-y: -40px;
}
  }

config.vue.js change publicPath to dist

module.exports = {
  lintOnSave: false,
  publicPath: "/dist/",
  css: {
    extract: false
  }
}

but after release, after npm install

clipboard.png
cannot get the picture.
Project address

Jun.17,2022

read it wrong. If you use a component, you need to transfer your picture to base64 or make it an online address. The relative path cannot be found when the component is used.

  • Initialize project problems with vue-cli

    * * set up a vue project according to a tutorial when npm install stops here for a long time, it doesn t move * * **vue-demonode_modules800120M,17000 vue** then the node.exe process accounts for 25% CPU, my computer CPU4 core, the process can not...

    Mar.02,2021
Menu