How to load images through webpack when using HTMLWebpackPlugin?

后端 未结 4 795
礼貌的吻别
礼貌的吻别 2020-12-29 20:38

I am using HTMLWebpackPlugin and in my template I have an img tag:


If you notice, here I am using a r

4条回答
  •  Happy的楠姐
    2020-12-29 21:16

    Using html-loader with HTML webpack plugin worked for me.

    module: {
        rules: [
          {
             test: /\.(html)$/,
             use: ['html-loader']
          }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
          template: './src/index.html'
        })
      ]
    

提交回复
热议问题