How does webpack handle pictures in html?

because pictures are preloaded in js , the pictures in HTML use data-src instead of src . I found that url-loader didn"t process these pictures, and then I used html-loader and didn"t process them either.

  {
    test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
    loader: "url-loader",
    options: {
      limit: 5120,
      name: assetsPath("images/[name].[hash:7].[ext]")
    }
  },
  {
    test: /\.(htm|html)$/i,
    loader: "html-loader?attrs=img:src img:data-src"
  }
Mar.31,2021

the path of the picture is written as data-src=require ('xxx.jpg')

Menu