vue项目打包发布后element的icon图标找不到

使用element框架的icon时候,开发环境下是没有问题的,打包完以后出现小方块,页面不显示

解决办法:找到utils.js文件,加 publicPath: '../../'

 

 

  function generateLoaders (loader, loaderOptions) {
    const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]

    if (loader) {
      loaders.push({
        loader: loader + '-loader',
        options: Object.assign({}, loaderOptions, {
          sourceMap: options.sourceMap
        })
      })
    }

    // Extract CSS when that option is specified
    // (which is the case during production build)
    if (options.extract) {
      return ExtractTextPlugin.extract({
        use: loaders,
        fallback: 'vue-style-loader',
        publicPath: '../../',//解决ele小图标出不来问题
      })
    } else {
      return ['vue-style-loader'].concat(loaders)
    }
  }

 

posted @ 2022-03-11 18:00  何以平天下  阅读(1539)  评论(0编辑  收藏  举报