When importing element-ui to package without using a tripod, it is found that the icon address path points to an error
The solution is to modify the build configuration
The first step is the webpack.base.conf.js file in the build directory
//在module 模块添加 字体规则
module: {
rules: [
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
The second part modifies the utils.js file in the build directory and adds publicPath: './../'
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader',
publicPath: '../../', //添加这个目录
})
} else {
return ['vue-style-loader'].concat(loaders)
}