引用elementUi 字体文件丢失导致图标都显示小方块
引用elementUi 控制台报错字体文件丢失 , 检查后发现是打包后css文件的引用路径出现问题,做出以下修改
在webpack.base.config.js中修改url-loader
1 { 2 test: /\.(woff2?|eot|ttf|otf|woff)(\?.*)?$/, 3 loader: 'url-loader', 4 options: { 5 limit: 10000, 6 name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 7 } 8 },
修改utils.js ,ExtractTextPlugin的publicPath的路径
1 // Extract CSS when that option is specified 2 // (which is the case during production build) 3 if (options.extract) { 4 return ExtractTextPlugin.extract({ 5 use: loaders, 6 fallback: 'vue-style-loader', 7 publicPath: '../../' 8 }) 9 } else { 10 return ['vue-style-loader'].concat(loaders) 11 }
————————————————
原文链接:https://blog.csdn.net/a578024797/article/details/103402807