当前位置:主页 > 网页前端 > vue >

解决webpack+Vue引入iView找不到字体文件的问题

时间:2020-12-24 11:33:17 | 栏目:vue | 点击:

原因:

css-loader后面带了参数modules(打包报错)

url-loader后面带了参数name(引入报错)

{
 test: /\.css$/,
 use: ExtractTextPlugin.extract({
 fallback: "style-loader",
 use: "css-loader?modules!postcss-loader"
 })
},
{
 test: /\.(svg|ttf|eot|woff)\??.*$/,
 loader: "url-loader?limit=10000&name=fonts/[name].[ext]"
}

解决方案:去掉参数

{
 test: /\.css$/,
 use: ExtractTextPlugin.extract({
 fallback: "style-loader",
 use: "css-loader!postcss-loader"
 })
},
{
 test: /\.(svg|ttf|eot|woff)\??.*$/,
 loader: "url-loader?limit=10000"
}

或者

{
 test: /\.css$/,
 exclude: /node_modules/,
 use: ExtractTextPlugin.extract({
 fallback: "style-loader",
 use: "css-loader?modules!postcss-loader"
 })
}, {
 test: /\.css$/,
 include: /node_modules/,
 use: ExtractTextPlugin.extract({
 fallback: "style-loader",
 use: "css-loader!postcss-loader"
 })
},
{
 test: /\.(svg|ttf|eot|woff)\??.*$/,
 loader: "url-loader?limit=10000"
}

您可能感兴趣的文章:

相关文章