vue-cli-service build --target lib loses images path when imported as lib

I have a similar problem, my fix for the time being is to add the following to vue.config.js:

module.exports = {
  css: {
    extract: false
  },
  chainWebpack: config => {
    config.module
      .rule("images")
      .use("url-loader")
      .loader("url-loader")
      .tap(options => Object.assign(options, { limit: Infinity }));
  }
};

This inlines all assets as base64 Data URLs.

Taken from: https://cli.vuejs.org/guide/html-and-static-assets.html#relative-path-imports

Edit:

For SVG try this:

module.exports = {
  css: {
    extract: false
  },
  chainWebpack: config => {
    const svgRule = config.module.rule('svg')
    svgRule.uses.clear()

    svgRule
      .test(/\.svg$/)
      .use('svg-url-loader') // npm install --save-dev svg-url-loader
      .loader('svg-url-loader')
  }
};

Remember this is far from optimal and a workaround!