解决Automatic publicPath is not supported in this browser问题
解决Automatic publicPath is not supported in this browser的报错
问题描述:
当我在webpack5进行打包的时候出现的错误
解决方案:
是因为打包图片的路径出现了问题,需要增加一个属性publicPath,才能正确的找到改图片
{
test: /\.(png|jpg|gif|svg)$/,
use: {
loader: "url-loader",
options: {
//需要添加publicPath属性
// 这个的静态资源路径为你打包图片相对于index.html的路径
publicPath: "./build",
name: "img/[name]-[hash:6].[ext]",
// 小于 100KB 的图片才打包
limit: 100 * 1024,
},
},
},
这样就没问题了