vue打包后404以及ElementUI打包后图标不显示问题

2022-06-26 13:07:54

1.vue打包404

config中index.js文件的build中的assetsPublicPath: '/',改为assetsPublicPath: './',

build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: './',
    //打包后正常运行
}

2.引入ElementUI打包后小图标不显示

build中until.js文件中if (options.extract)判断下加入publicPath:'../../'

if (options.extract) {
      return ExtractTextPlugin.extract({
        use: loaders,
        fallback: 'vue-style-loader',
		publicPath:'../../',
	    // 打包后elementui显示图标	
      })
    } else {
      return ['vue-style-loader'].concat(loaders)
    }

 总结:都是路径问题。

  • 作者:wx_zylsghhzy
  • 原文链接:https://blog.csdn.net/progrmmmm/article/details/120781124
    更新时间:2022-06-26 13:07:54