vue-cli构建项目 背景图路径问题

最近在写vue项目的时候,打包之后发现了有些背景图片报了找不到的错误。


先看一下打包之后的路径如下,发现多了两级所以找不到。


更改:bulid/utils.js    

  // Extract CSS when that option is specified
    // (which is the case during production build)
    if (options.extract) {
      return ExtractTextPlugin.extract({
        use: loaders,
        publicPath: '../../',  //多几级就写几个  “../../”
        fallback: 'vue-style-loader'
      })
    } else {
      return ['vue-style-loader'].concat(loaders)
    }

猜你喜欢

转载自blog.csdn.net/wang1006008051/article/details/80322673